当前位置: 编程技术>.net/c#/asp.net
C#定位txt指定行的方法小例子
来源: 互联网 发布时间:2014-10-19
本文导语: 代码如下: [DllImport("User32.dll", EntryPoint = "FindWindow")] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport("user32.dll")] static extern IntPtr FindWindowEx(...
代码如下:
[DllImport("User32.dll", EntryPoint = "FindWindow")]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
[DllImport("user32.dll")]
static extern bool SetForegroundWindow(IntPtr hWnd);
///
/// 定位到txt文件指定行
///
///文件路径
///指定行
///定位是否成功
private bool LocateNotePad(string strFullName, string strRow)
{
int iRow;
int.TryParse(strRow, out iRow);
if (iRow