当前位置: 代码迷 >> VFP >> 在vfp中怎么根据IE窗口的HWND操作IE窗口对象
  详细解决方案

在vfp中怎么根据IE窗口的HWND操作IE窗口对象

热度:2582   发布时间:2013-02-26 00:00:00.0
在vfp中如何根据IE窗口的HWND操作IE窗口对象
在vfp中如何根据IE窗口的HWND操作IE窗口对象

------解决方案--------------------------------------------------------
不知道你传入的窗口句柄是在哪一层
如果是 Internet Explorer_Server 这个类窗口的句柄,用下面的代码:
VB code
*-- 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