Home > Software engineering >  Dialog box under win32 program to add variables, display could not find the dialog class with a spec
Dialog box under win32 program to add variables, display could not find the dialog class with a spec

Time:11-08



Is roughly vs to create a new Windows program to modify, will delete all window class related content, the newly created dialog box,
Run screenshot:


# include "framework. H"
# include "shut0. H"

# define MAX_LOADSTRING 100

//global variables:
HINSTANCE hInst,//the current instance
LRESULT MainDlgProc (HWND hDlg, UINT message, WPARAM WPARAM, LPARAM LPARAM);

Int APIENTRY wWinMain (_In_ HINSTANCE HINSTANCE,

_In_opt_ HINSTANCE hPrevInstance,_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
HInst=hInstance;

HWND hDlg=CreateDialog (hInstance, LPCTSTR IDD_MAIN, 0, DLGPROC MainDlgProc);
ShowWindow (hDlg, nCmdShow);

HACCEL hAccelTable=LoadAccelerators (hInstance, MAKEINTRESOURCE (IDD_MAIN));

MSG MSG.

//the main message loop:
While (GetMessage (& amp; MSG, nullptr, 0, 0))
{
if (! TranslateAccelerator (MSG. The HWND hAccelTable, & amp; MSG))
{
TranslateMessage (& amp; MSG);
DispatchMessage (& amp; MSG);
}
}

Return (int) MSG. WParam;
}

LRESULT MainDlgProc (HWND hDlg, UINT message, WPARAM WPARAM, LPARAM LPARAM)
{
UNREFERENCED_PARAMETER (lParam);
The switch (the message)
{
Case WM_CLOSE:
The DestroyWindow (hDlg);
Return TRUE;
break;
Case WM_DESTROY:
The PostQuitMessage (0);
Return TRUE;
}
Return (INT_PTR) FALSE;
}

CodePudding user response:

To use win32 way, cannot use this wizard to add a member variable, all have to manually to.

Need to be able to use the wizard to associate the control variable, you have to create an MFC project.

CodePudding user response:

Ok, I see, thank you
  • Related