begin
if not assigned(form2) then
begin
application.createform(Tform2.form2);
try
form2.showmodal;
finally
form2.free;
form2:=nil;
end;
end else
form2.showmodal;
end;
wcl.lpszMenuName := nil; // no menu
wcl.cbClsExtra := 0; // no extra information needed
wcl.cbWndExtra := 0; // no extra information needed
wcl.hbrBackground :=COLOR_WINDOWFRAME; //框架所创建的背景颜色
// Register the window class.
if RegisterClass(wcl) = 0 then
Exit;
//创建窗口
hwnd := CreateWindow(
'FirstWinMain', // name of window class
'Windows 98 Skeleton', //name of window
WS_OVERLAPPEDWINDOW, // window style - normal
Integer(CW_USEDEFAULT),
Integer(CW_USEDEFAULT),
Integer(CW_USEDEFAULT),
Integer(CW_USEDEFAULT),
0,
0,
hInstance,
nil
);
if hwnd=0 then
Exit;
// Display the window.
//显示窗口
ShowWindow(hwnd, SW_SHOWNORMAL);
UpdateWindow(hWnd);
// Create the message loop.
//消息循环
while GetMessage(msg, hwnd, 0, 0) do
begin
TranslateMessage(msg); // translate keyboard messages
DispatchMessage(msg); // return control to Windows 98
end;