# include & lt; Windows. H>
# include & lt; Commctrl. H>
# include & lt; stdio.h>
# include "resource. H"
# define DLG_MAIN 100
# define IDCANCEL 1003
# define IDOK 1004
Void MESSAGE ();
HINSTANCE hInst,
BOOL CALLBACK DlgMain (HWND hwndDlg, UINT uMsg, WPARAM WPARAM, LPARAM LPARAM)
{
The switch (uMsg)
{
Case WM_INITDIALOG:;
Return TRUE;
Case WM_CLOSE:
{
EndDialog (hwndDlg, 0);
}
Return TRUE;
Case WM_COMMAND:
{
The switch (LOWORD (wParam))
{
Case IDCANCEL:;
Case IDOK:;
}
}
Return TRUE;
}
Return DefWindowProc (hwndDlg uMsg, wParam, lParam);
}
Int WinMain (HINSTANCE HINSTANCE, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
HInst=hInstance;
HWND HDLG=CreateDialog (hInst, MAKEINTRESOURCE (DLG_MAIN), GetDesktopWindow (), DlgMain);
//RegisterClassA (& amp; HDLG);
if (! HDLG)
{
GetLastError ();
MessageBox (NULL,
"Call to CreateDialog failed!" ,
"Windows Desktop Guided Tour",
NULL);
return 1;
}
ShowWindow (HDLG, SW_SHOW);
UpdateWindow (HDLG);
The MESSAGE ();
return 0;//DialogBox (hInst, MAKEINTRESOURCE (DLG_MAIN), NULL, DLGPROC DlgMain);
}
Void MESSAGE () {
MSG MSG={0};
While (GetMessage (& amp; MSG, NULL, 0, 0)) {
TranslateMessage (& amp; MSG);
DispatchMessage (& amp; MSG);
}
}
CodePudding user response:
//
//FUNCTION: InitInstance (HANDLE, int)
//
//PURPOSE: Saves the instance handle and creates the main window
//
//COMMENTS:
//
//In this function, we save the instance handle In a global variable and
//create and display the main program window.
//
BOOL InitInstance (HINSTANCE HINSTANCE, int nCmdShow)
{
HWND hWnd;
HInst=hInstance;//Store the instance handle in our global variable
HWnd=CreateDialog (hInst, MAKEINTRESOURCE (IDD_DIALOG1), NULL, DialogProc);
if (! HWnd)
{
return FALSE;
}
ShowWindow (hWnd, nCmdShow);
UpdateWindow (hWnd);
Return TRUE;
}
CodePudding user response:
But still returns null, can only display the wrong popup window,CodePudding user response:
When I was in the rc resources appeared resource. Rc (23) : warning RC2182: duplicate dialog control ID 0 this warning, could it be this reason,CodePudding user response:
As long as DLG_MAINCodePudding user response:
Your DLG_MAIN dialog resource effective?CodePudding user response: