winclass.hbrBackground =(HBRUSH) GetStockObject(BLACK_BRUSH);
winclass.lpszMenuName = NULL;
winclass.lpszClassName = "WINCLASS1";
winclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
return (RegisterClassEx(&winclass));
}
//-------------------------------------------------------------------------------------------------
// InitInstance-产生窗口,显示以及更新窗口
//-------------------------------------------------------------------------------------------------
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
g_hInst=hInstance;
g_hWnd=CreateWindowEx(NULL,
"WINCLASS1",
szTitle,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
if(!g_hWnd)
{
return FALSE;
}
ShowWindow(g_hWnd,nCmdShow);
UpdateWindow(g_hWnd);
return TRUE;
}
int CALLBACK WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
MSG msg;
UNREFERENCED_PARAMETER(lpCmdLine);
if (!hPrevInstance)
{
if (!InitApplication(hInstance))
{
return (FALSE);
}
}
if (!InitInstance(hInstance,nCmdShow))
{
return FALSE;
}
SetTimer(g_hWnd,1,150,NULL);
while (GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (msg.wParam);
}
五、总结
利用我们再学校学习的C/C++对付平时的一些应用时足够的,只要我们打开思路,我们就能做出一些“高手”才能做的东西,这也是我们成长成为高手必经之路。有什么问题,欢迎大家及时与我讨论。