I am very new to C. I have created an application that calls a DLL. The DLL is used to create a dialog with a bunch of labels and edit boxes on them. On the dialog is a Quit button. The DLL handles this as well. When the Quit button is clicked, I need to close the entire application, the dialog as well and the parent form. Here's what I have so far:
Code:
LRESULT CALLBACK ParseDialogProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
{
static HWND hWndChild;
char* cBuffer;
int iLength;
const int iMaxBufferSize = 500;
char sMsgBuffer[iMaxBufferSize];
switch(message)
{
case WM_INITDIALOG:
hWndChild = (HWND)GetParent(hWnd);
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case btnParse:
//there is some code here but it all works so i omitted it
case btnExit:
SendMessage(hWndChild,WM_CLOSE,NULL,NULL);
break;
}
break;
default:
return DefWindowProc(hWnd,message,wParam,lParam);
break;
}
return 0;
}
When I debug, it hits the SendMessage(hWndChild, WM_CLOSE,NULL,NULL) line, then goes to the return line. And I get this error then: Unhandled exception in ParseName.exe: 0xC0000005: Access Violation.