受不了这该死的delete[]
HWND ieHWND = ::FindWindow(L "IEFrame ",NULL);
CWnd* ieWnd = CWnd::FromHandle(ieHWND);
//CWnd* addressEditWnd = ieWnd-> FindWindowW(_T( "Edit "),NULL);
//int textLen = addressEditWnd-> GetWindowTextLengthW();
//LPTSTR text = new TCHAR[textLen];
//addressEditWnd-> GetWindowTextW(text,textLen);
//CWnd* workerWWnd = ieWnd-> FindWindowW(L "WorkerW ",NULL);
//CWnd* reBarWindow32Wnd = workerWWnd-> FindWindowW(L "ReBarWindow32 ",NULL);
//CWnd* comboBoxEx32Wnd = workerWWnd-> FindWindowW(L "ComboBoxEx32 ",NULL);
//int textLen = ieWnd-> GetWindowTextLengthW();
//LPTSTR text = new TCHAR[textLen];
//ieWnd-> GetWindowTextW(text,textLen);
//if (text != NULL)
//{
//delete[] text;
//}
LPWSTR buffer = new WCHAR[7];
::GetClassName(ieWnd-> m_hWnd,buffer,8);
if (buffer != NULL)
{
delete[] buffer;
}
高人们为什么删除buffer时会出错?
[解决办法]
越界访问过了的内存块,delete就会出错。