在vfp中如何根据IE窗口的HWND操作IE窗口对象
在vfp中如何根据IE窗口的HWND操作IE窗口对象
[解决办法]
不知道你传入的窗口句柄是在哪一层
如果是 Internet Explorer_Server 这个类窗口的句柄,用下面的代码:
*-- vfp9 代码...Function GetObjFromHwnd(tnHwnd) Local nMsg, nRes, oRet Declare Long RegisterWindowMessage In win32api String Declare Long SendMessageTimeout In win32api Long, Long, Long, Long, Long, Long, Long @ Declare Long ObjectFromLresult In oleacc Long, String, Long, Object @ oRet = Null nMsg = RegisterWindowMessage('WM_HTML_GETOBJECT') nRes = 0 SendMessageTimeout(tnHwnd, nMsg, 0, 0, 2, 1000, @ nRes) If nRes > 0 ObjectFromLresult(nRes, 0h20C56F621EA4CF11A73100A0C9082637, 0, @ oRet) Endif Return oRetEndfunc