马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
关闭不了 把窗口关了 程序还在运行#include <windows.h>
#include <stdio.h>
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wPARAW, LPARAM lPARAW);
void SystemWindowClass(HINSTANCE hlnstance) //系统窗口类
{
/*免去注册窗口类*/
/*使用系统提供的窗口类*/
/*使用系统提供的窗口类是 CreateWindow的第一个参数为创建一个什么类型的窗口 如button是按钮 edit是编辑*/
HWND hWnd = CreateWindow(L"button", L"GSD", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hlnstance, NULL); //
ShowWindow(hWnd,SW_SHOW);
UpdateWindow(hWnd);
MSG nMSG = { 0 };
while (GetMessage(&nMSG, NULL, 0, 0))
{
TranslateMessage(&nMSG);
DispatchMessage(&nMSG);
}
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wPARAW, LPARAM lPARAW)
{
switch (msg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
}
return DefWindowProc(hWnd, msg, wPARAW, lPARAW);
}
int APIENTRY WinMain(
__in HINSTANCE hlnstance,
__in_opt HINSTANCE hPrevInstance,
__in LPSTR nCmdLine,
__in int CmdShow
)
{
SystemWindowClass(hlnstance);
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wPARAW, LPARAM lPARAW);
return 0;
}
|