首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

受不了这该死的delete[]解决方案

2012-02-02 
受不了这该死的delete[]HWNDieHWND::FindWindow(L IEFrame ,NULL)CWnd*ieWndCWnd::FromHandle(ieHWND

受不了这该死的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就会出错。

热点排行