问题:int main(){ HWND hWorker,hRebar,hComEx,hcom,hEdit; HWND hwndParent=::FindWindow(LIEFrame,NULL);//找到最近的IE,要是找到某个IE需要枚举所有的IE过筛子 if(hwndParent == NULL)//没有IE运行中 return FALSE; char szURL[260]; memset(szURL, 0, 260); hWorker=FindWindowEx(hwndParent,0,LWorkerA,NULL);//找到工作区 if(hWorker == NULL)//用户用NT hWorker=FindWindowEx(hwndParent,0L,LWorkerW,NULL);//WindowNT中的ie hRebar=FindWindowEx(hWorker,0,LReBarWindow32,NULL);//找到Rebar hComEx=FindWindowEx(hRebar,0,LComboBoxEx32,NULL);//找到Comboboxex hcom=FindWindowEx(hComEx,0,LComboBox,NULL);//找到combobox hEdit=FindWindowEx(hcom,0,LEdit,NULL);//找到ComBoBox的edit控件句柄 ::SendMessage(hEdit,WM_GETTEXT,260,(LPARAM) szURL); AfxMessageBox((LPCTSTR)szURL); return TRUE; // cout << szError <<endl; }
在 98 下可能会好使, 目前 Windows 为了安全起见, 像 WM_GETTEXT 这类的消息的发送不能跨进程, 可以用线程注入的方式向目标进程注入你自己的一个 DLL, 再在 DLL 中发送这个消息. 如果你对int main(){ HWND hWorker,hRebar,hComEx,hcom,hEdit; HWND hwndParent=::FindWindow(LIEFrame,NULL);//找到最近的IE,要是找到某个IE需要枚举所有的IE过筛子 if(hwndParent == NULL)//没有IE运行中 return FALSE; char szURL[260]; memset(szURL, 0, 260); hWorker=FindWindowEx(hwndParent,0,LWorkerA,NULL);//找到工作区 if(hWorker == NULL)//用户用NT hWorker=FindWindowEx(hwndParent,0L,LWorkerW,NULL);//WindowNT中的ie hRebar=FindWindowEx(hWorker,0,LReBarWindow32,NULL);//找到Rebar hComEx=FindWindowEx(hRebar,0,LComboBoxEx32,NULL);//找到Comboboxex hcom=FindWindowEx(hComEx,0,LComboBox,NULL);//找到combobox hEdit=FindWindowEx(hcom,0,LEdit,NULL);//找到ComBoBox的edit控件句柄 ::SendMessage(hEdit,WM_GETTEXT,260,(LPARAM) szURL); AfxMessageBox((LPCTSTR)szURL); return TRUE; // cout << szError <<endl; }这个问题有好的意见或
建议,请留言
|