win32 dialog problem

Started by
3 comments, last by yadango 17 years, 9 months ago
First off I am using VS .Net to make the dialog templete. This is not the first time i have done this and all the others in my program do not have this problem. The problem I am haveing is this, I have use the CreateDialog() function to make a dialog box. However, all that apears is the static text the dialog its self is never drawn. I set the flags using VS's gui interface to Visiable = true and Disabled = false. The style = Child. First i will the CreateDialog function i use in my program


	CreateProgressDialog = CreateDialog(hInst, (LPCTSTR)IDD_CREATE_MAP_PROGRESS,
				         hWnd, (DLGPROC)CreateMapProgress);
Next is the DLGPROC CreateMapProgress, nothing is there really


LRESULT CALLBACK CreateMapProgress(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {

	switch(message) {

		case WM_INITDIALOG:
			
			break;

		case WM_DESTROY:

			break;
	}//end message switch
	return TRUE;
}//end CreateMapProgress


I have no idea why the dialog itself is not showing and am completely stumped on this problem and welcome anyone who can give me something to go on to fix this.
Advertisement
Dont set the child property. Child windows are shown in the client area of their parents. Your dialog is not a child window - your dialog is owned by your window. The difference is subtled and not accurately noted in the MSDN.
you also can't do "(LPCTSTR)IDD_CREATE_MAP_PROGRESS" that. you have to use the MAKEINTRESOURCE macro, which does a little more than just cast to a c-string (it actually does 2 casts to make sure the resulting c-string is null-terminated).
Y-Go
you also need to close down the dialog box by issuing an EndDialog call, typically while handling the IDOK and IDCANCEL WM_COMMAND msgs. otherwise your modal dialog box will not go away.
CreateDialog() creates a modeless dialog, DialoxBox() creates a modal one. his message proc still has a problem though -- it should return FALSE if the message isn't handled or the default is required. his always returns TRUE.

This topic is closed to new replies.

Advertisement