#include <Windows.h>
#pragma comment(linker, "/ENTRY:Entry")
#pragma comment(linker, "/subsystem:windows")
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_DESTROY) PostQuitMessage(0);/*不加这一行进程不会结束。主函数的最后也不用加ExitProcess(0);了*/
else return(DefWindowProc(hWnd,uMsg,wParam,lParam));
}
void Entry()
{
WNDCLASSEX sWndClassEx = {48,3,WindowProc,0,0,GetModuleHandle(0),0,LoadCursor(0,IDC_ARROW),(HBRUSH)6,0,L"correy",0};
ATOM a = RegisterClassEx(&sWndClassEx);
ShowWindow(CreateWindowEx(0,L"correy",L"correy",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,0,0,GetModuleHandle(0),0),1);
MSG sMsg;
while (GetMessage(&sMsg,0,0,0)) { DispatchMessage(&sMsg); }
}
//2012.08.25进一步改进。
////////////////////////////////////////////////////////////////////////////
#include <Windows.h>
#pragma comment(linker, "/ENTRY:Entry")
#pragma comment(linker, "/subsystem:windows")
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return(DefWindowProc(hWnd, uMsg, wParam, lParam));
}
return(0);
}
void Entry()
{
WNDCLASSEX sWndClassEx = {48,3,WindowProc,0,0,GetModuleHandle(0),0,LoadCursor(0,IDC_ARROW),(HBRUSH)6,0,"correy",0};
ATOM a = RegisterClassEx(&sWndClassEx);
ShowWindow(CreateWindowEx(0,"correy","correy",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,0,0, GetModuleHandle(0),0),1);
MSG sMsg;
while (GetMessage(&sMsg, NULL, 0, 0))
{
DispatchMessage(&sMsg);
}
ExitProcess(0);
}
//made at 2011.10.08
//简单吧!简单到让人觉得不简单,这就达到了我的目的。
没有评论:
发表评论