请帮忙看看我的代码有什么问题 (40分)

T

t365

Unregistered / Unconfirmed
GUEST, unregistred user!
uses
Windows,Messages;
var hinstance:Dword;
CommandLine:pchar;
ClassName,AppName:pchar;
procedure WndProc(hwnd:DWord;uMsg:Word;wParam:word;lParam:word);
begin
IF uMsg=WM_DESTROY then
PostQuitMessage(0)
else
DefWindowProc(hWnd,uMsg,wParam,lParam);
end;
function winMain(hInst,hPrevInstance:LongWord;
lpCmdLine:LPSTR;nCmdShow:integer):DWord;
var wc:WNDCLASSEX;
hWnd:Dword;
msg:TMsg;
begin
ClassName := 'test';
AppName :='hehe';
wc.cbSize := SIZEOF(WNDCLASSEX);
wc.style := CS_HREDRAW or CS_VREDRAW;
wc.lpfnWndProc := @wndproc;
wc.cbClsExtra :=0;
wc.cbWndExtra :=0;
wc.hInstance := Hinstance;
wc.hbrBackground :=COLOR_WINDOW+1;
wc.lpszMenuName:=nil;
wc.lpszClassName:= ClassName;
wc.hIcon := LoadIcon(0,IDI_APPLICATION);
wc.hIconSm:= LoadIcon(0,IDI_APPLICATION);
wc.hCursor := LoadCursor(0,IDC_ARROW);
RegisterClassEx(wc);

hWnd := CreateWindowEx(0,ClassName,AppName,
WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,0,0,
hInst,nil);
ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd);
while TRUE do
IF not GetMessage(msg,0,0,0) then
begin
TranslateMessage(msg);
DispatchMessage(msg);
end;
Result:=0;
end;
begin
hInstance:=GetModuleHandle(Nil);
CommandLine := GetCommandLine;
WinMain(hInstance,0,CommandLine, SW_SHOWDEFAULT);
end.
学习中,在消息处理上好象有好题,但不得要领,请朋友们帮忙看看!
 
应该能退出吧!
 
你相当于是把WM_DESTROY消息屏蔽了哦,你这个程序到底想要搞什么哦?
 
將 begin

end

標註 ( in different color );
 
多人接受答案了。
 
顶部