Debug Assertion Failed(File wingdi.cpp, line : 1054)
-
Hi All, I created one MFC extension dll and loaded the exporated function in another sample MFC SDI application on click of the toolbar events.This application is almost looks simmilar to paintbrush where the exported functions are having the implementaion of painting methods.The MFC sample EXE is just to call the extention DLL and call each exported fucntion(in .DEF file of MFC Extension DLL) to test whether the actions are having or not but for one function i am getting runtime error while excuting the MFC sample EXE i.e. "Debug Assertion Failed". Program path of the sample MFC SDI exe...... File : wingdi.cpp Line : 1054 I am giving following code snippets.... HDC hdc = NULL; UINT uIntRect = 0;//RECTANGLE; HWND hwnd = NULL; BOOL uReturnVal= FALSE; LPFNDLL_drawShape lpfndll_drawRectangle; HMODULE hModule = LoadLibrary("D:\\FancyViewer\\Notebook_13July2006\\Notebook\\Debug\\Notebook.dll"); if(hModule) { lpfndll_drawRectangle = (LPFNDLL_drawShape)GetProcAddress(hModule,"drawShape"); if (!lpfndll_drawRectangle) { AfxMessageBox("GetProcAddress() method is failed"); FreeLibrary(hModule); return; } else { CRect rect; GetClientRect(rect); CPaintDC dc1(this); CDC dcMem; dcMem.CreateCompatibleDC(&dc1); hwnd = (HWND)dc1.GetWindow(); hdc = dc1.Detach(); uIntRect = RECTANGLE; // call the function of drawShape method for rectangle of Notebook.dll uReturnVal = lpfndll_drawRectangle(hdc,uIntRect,hwnd); ASSERT(uReturnVal == TRUE); char buffer[65]; MessageBox(_itoa(GetLastError(),buffer,10),NULL,MB_OK); return; } } else { AfxMessageBox("Load library failed"); return; } GetLastError();
-
Hi All, I created one MFC extension dll and loaded the exporated function in another sample MFC SDI application on click of the toolbar events.This application is almost looks simmilar to paintbrush where the exported functions are having the implementaion of painting methods.The MFC sample EXE is just to call the extention DLL and call each exported fucntion(in .DEF file of MFC Extension DLL) to test whether the actions are having or not but for one function i am getting runtime error while excuting the MFC sample EXE i.e. "Debug Assertion Failed". Program path of the sample MFC SDI exe...... File : wingdi.cpp Line : 1054 I am giving following code snippets.... HDC hdc = NULL; UINT uIntRect = 0;//RECTANGLE; HWND hwnd = NULL; BOOL uReturnVal= FALSE; LPFNDLL_drawShape lpfndll_drawRectangle; HMODULE hModule = LoadLibrary("D:\\FancyViewer\\Notebook_13July2006\\Notebook\\Debug\\Notebook.dll"); if(hModule) { lpfndll_drawRectangle = (LPFNDLL_drawShape)GetProcAddress(hModule,"drawShape"); if (!lpfndll_drawRectangle) { AfxMessageBox("GetProcAddress() method is failed"); FreeLibrary(hModule); return; } else { CRect rect; GetClientRect(rect); CPaintDC dc1(this); CDC dcMem; dcMem.CreateCompatibleDC(&dc1); hwnd = (HWND)dc1.GetWindow(); hdc = dc1.Detach(); uIntRect = RECTANGLE; // call the function of drawShape method for rectangle of Notebook.dll uReturnVal = lpfndll_drawRectangle(hdc,uIntRect,hwnd); ASSERT(uReturnVal == TRUE); char buffer[65]; MessageBox(_itoa(GetLastError(),buffer,10),NULL,MB_OK); return; } } else { AfxMessageBox("Load library failed"); return; } GetLastError();
Where does the assertion take place, I mean which line in your code?
Nibu thomas A Developer Programming tips[^] My site[^]