我使用Spy ++扫描了Windows类,得到了这个“ 呼叫者” groupbox
,仅提取了以下标头名称:“呼叫者”,但无法读取groupbox
内部的电话号码:
using System.Runtime.InteropServices;
const int WM_GETTEXT = 0x0D;
[DllImport("user32.dll", EntryPoint = "SendMessageW")]
public static extern int SendMessageW([InAttribute] System.IntPtr hWnd, int Msg, int wParam, IntPtr lParam);
public static string GetText(IntPtr handle)
{
int maxLength = 512;
IntPtr buffer = Marshal.AllocHGlobal((maxLength + 1) * 2);
SendMessageW(handle, WM_GETTEXT, maxLength, buffer);
string w = Marshal.PtrToStringUni(buffer);
Marshal.FreeHGlobal(buffer);
return w;
}
我正在尝试提取这样的文本:
var ptr = new IntPtr(0x000308EE);
var t = GetText(ptr);
仅在t
变量中获取文本“ Caller”。如何从 groupbox 内部获取电话号码?