得到IE地址栏内容的代码,为什么不好使?
程序代码:int main()
{
HWND hWorker,hRebar,hComEx,hcom,hEdit;
HWND hwndParent=::FindWindow(L"IEFrame",NULL);//找到最近的IE,要是找到某个IE需要枚举所有的IE过筛子
if(hwndParent == NULL)//没有IE运行中
return FALSE;
char szURL[260];
memset(szURL, 0, 260);
hWorker=FindWindowEx(hwndParent,0,L"WorkerA",NULL);//找到工作区
if(hWorker == NULL)//用户用NT
hWorker=FindWindowEx(hwndParent,0L,L"WorkerW",NULL);//WindowNT中的ie
hRebar=FindWindowEx(hWorker,0,L"ReBarWindow32",NULL);//找到Rebar
hComEx=FindWindowEx(hRebar,0,L"ComboBoxEx32",NULL);//找到Comboboxex
hcom=FindWindowEx(hComEx,0,L"ComboBox",NULL);//找到combobox
hEdit=FindWindowEx(hcom,0,L"Edit",NULL);//找到ComBoBox的edit控件句柄
::SendMessage(hEdit,WM_GETTEXT,260,(LPARAM) szURL);
AfxMessageBox((LPCTSTR)szURL);
return TRUE;
// cout << szError <<endl;
}






