# include
INT the CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
Char szClassName []="windowclass1";
Char szAppTitle []="Chen";
INT PASCAL WinMain (HINSTANCE HINSTANCE, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, INT nCmdShow)
{
The HWND hMainWnd;
MSG MSG.
WNDCLASS myWC;
if(! HPrevInstance)
{
MyWC. Style=CS_HREDRAW | CS_VREDRAW;
MyWC. LpfnWndProc=WndProc;
MyWC. CbClsExtra=0;
MyWC. CbWndExtra=0;
MyWC. HInstance=hInstance;
MyWC. HIcon=LoadIcon (NULL, IDI_APPLICATION);
MyWC. HCursor=LoadCursor (NULL, IDC_ARROW);
MyWC. HbrBackground=GetStockObject (WHITE_BRUSH);
MyWC. LpszMenuName=NULL;
MyWC. LpszClassName=szClassName;
}
HMainWnd=CreateWindow (
SzClassName,
SzAppTitle,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT CW_USEDEFAULT,
CW_USEDEFAULT CW_USEDEFAULT,
NULL, NULL, hInstance, NULL);
ShowWindow (hMainWnd SW_SHOWMAXIMIZED);
UpdateWindow (hMainWnd);
While (GetMessage (& amp; MSG, NULL, 0, 0))
{
TranslateMessage (& amp; MSG);
DispatchMessage (& amp; MSG);
}
Return MSG. WParam;
}
INT the CALLBACK WndProc (HWND hMainwnd, UINT message, WPARAM WPARAM, LPARAM LPARAM)
{
Char messageleft []="the left button have had pushed";
Char messageright []="the right button have had pushed";
The switch (the message)
{
Case WM_RBUTTONDOWN:
{
Messageright MessageBox (GetFocus (), "Chen", MB_OK | MB_ICONINFORMATION);
break;
}
Case WM_LBUTTONDOWN:
{
Messageleft MessageBox (GetFocus (), "Chen", MB_OK | MB_ICONINFORMATION);
break;
}
Case WM_DESTROY:
{
The PostQuitMessage (0);
return 0;
}
Default:
break;
}
Return DefWindowProc (hMainwnd, message, wParam, lParam);
}
Configuration: progect4 - Win32 Debug -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The Compiling...
4.1. The CPP
F: \ software c + + 6.0 6.0 \ progect4 \ \ c + + Book 4.1 CPP (13) : error C2440: '=' : always convert from 'int (__stdcall *) (struct HWND__ *, unsigned int, unsigned int, long)' to 'long (__stdcall *) (struct HWND__ *, unsigned int, unsigned int, long)'
This conversion requires a reinterpret_cast, a C - style cast the or function - style cast
F: \ software c + + 6.0 6.0 \ progect4 \ \ c + + Book 4.1 CPP (19) : error C2440: '=' : always convert from 'void *' to 'struct HBRUSH__ *'
Conversion from 'void * to pointer to non -' void 'requires an explicit cast
Error executing cl. Exe.
4.1. Obj - 2 error (s), and 0 warning (s)
CodePudding user response:
Not INT the CALLBACK WndProcLong WINAPI WndProc
# define CALLBACK __stdcall
# define WINAPI __stdcall
# define WINAPIV __cdecl
# define APIENTRY WINAPI
# define APIPRIVATE __stdcall
# define PASCAL __stdcall
Yong WINAPI
CodePudding user response:
LRESULT a CALLBACK WndProc (HWND hMainwnd, UINT message, WPARAM WPARAM, LPARAM LPARAM)CodePudding user response:
To learn Sun Xin video, simulation of the MFC window the boot process,CodePudding user response:
This information has ah, hint of clear, don't understandCodePudding user response:
A bit dizzy dizzy