- 积分
- 22816
- 明经币
- 个
- 注册时间
- 2016-5-25
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
本帖最后由 jun353835273 于 2020-3-7 11:13 编辑
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;
- }
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
|