BOOL CALLBACK aaa(HWND hwnd, LPARAM lParam) //注意:这里并不是对话框的成员函数,这个函数我就是直接写在OnButton1上面的
{
char lpWinTitle[256];
::GetWindowText(hwnd,lpWinTitle,256-1);
CString m_strTitle;
m_strTitle.Format("%s",lpWinTitle);
CListCtrl *p = (CListCtrl*)GetDlgItem(????,IDC_LIST1); //这里的GetDlgItem被认为是win32 api了,需要hWnd参数了,不知怎样获得对话框的hwnd
p->InsertItem(0,m_strTitle);
if(m_strTitle.Find("Internet Explorer")!=-1)
{
AfxMessageBox("这是一个IE窗口!") ;
//CloseWindow(hwnd);
if(!DestroyWindow(hwnd)) //这里为何无法毁灭窗口??
{
DWORD d = GetLastError();
AfxMessageBox("毀滅窗口失敗!");
};
}
return TRUE ;
}
void CDlg3Dlg::OnButton1()
{
// TODO: Add your control notification handler code here EnumWindows(aaa,NULL);}
你这说的太高深了,我不会啊我这么写对吗?
CListCtrl *p = (CListCtrl*)GetDlgItem(AfxGetApp()->m_pMainWnd->m_hWnd,IDC_LIST1);