Why can I not pass an HWND* just like any other pointer to my dll?
Here is the guts of my dll, it does nothing with the HWND.
extern "C" bool Func1(HWND* pMy)
{
bool bReturn = TRUE;
AfxMessageBox("Func1 active"
return bReturn;
}//Is_RTF_Control_Available
This is my one line def file entry
EXPORTS
Func1 @1
As you can see from the code of my Func1 I allocate no memory and I do nothing with the HWND*.
This is my calling function.
void CTestExeDlg::OnOK()
{
typedef bool (CALLBACK* TestDll) (HWND*);//( );
bool bResult;
TestDll pFunc1 = NULL;
HINSTANCE hInstance = LoadLibrary("TestDll.dll"
if(hInstance) {
pFunc1 = (TestDll) GetProcAddress(hInstance,"Func1"
if(pFunc1)
bResult = pFunc1(&m_hWnd);
}
AfxMessageBox("Returned"
if(hInstance){
AfxFreeLibrary(hInstance);
AfxMessageBox("Frreed"
}
CDialog::OnOK();
}
This code works perfect in debug mode, but the stack gets corrupted in release mode. Does anybody know why?
Thanks.




;
