LISP调用方式(ReadTencentqqId)
如果登录的一个qq可以获取,多个qq只能获取最后登录的那个QQ号
代码网上找的,只是定义为LISP函数而已
-
- //导入库 [DllImport("user32.dll")]
- [DllImport("user32.dll", EntryPoint = "FindWindowA", CharSet = CharSet.Ansi)]
- private static extern int FindWindow(string lpClassName, string lpWindowName);
- [DllImport("user32.dll", EntryPoint = "GetWindowText")]
- public static extern int GetWindowText(int hwnd, StringBuilder lpString, int cch);
- [DllImport("user32.dll", EntryPoint = "GetWindow")]
- public static extern int GetWindow(int hwnd, int wCmd);
- [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
- public static extern int GetClassName(int hWnd, StringBuilder lpClassName, int nMaxCount);
- [LispFunction("ReadTencentqqId")]
- public static string ReadTencentqqId(ResultBuffer rb)
- {
- string str = "";
- int hWin = FindWindow("CTXOPConntion_Class", null);
- if (hWin == 0)
- {
- return null;
- }
- System.Text.StringBuilder sbf = new StringBuilder(256);
- StringBuilder sbfClass = new StringBuilder(256);
- while (hWin > 0)
- {
- GetWindowText(hWin, sbf, sbf.Capacity);
- if (sbf.ToString().Contains("OP_"))
- {
- int index = sbf.ToString().IndexOf('_');
- str = sbf.ToString().Substring(index + 1, sbf.Length - index - 1);
- break;
- }
- }
- return str;
- }
本帖以下内容被隐藏保护;需要你回复后,才能看到! 游客,如果您要查看本帖隐藏内容请 回复 |