procedure TApplication.CreateHandle;<br>var<br> TempClass: TWndClass;<br> SysMenu: HMenu;<br>begin<br> if not FHandleCreated<br>{$IFDEF MSWINDOWS}<br> and not IsConsole then<br>{$ENDIF}<br>{$IFDEF LINUX}<br> then<br>{$ENDIF}<br> begin<br>{$IFDEF LINUX}<br> FObjectInstance := WinUtils.MakeObjectInstance(WndProc);<br>{$ENDIF}<br>{$IFDEF MSWINDOWS}<br> FObjectInstance := Classes.MakeObjectInstance(WndProc);<br>{$ENDIF}<br> WindowClass.lpfnWndProc := @DefWindowProc;<br> if not GetClassInfo(HInstance, WindowClass.lpszClassName, TempClass) then<br> begin<br> WindowClass.hInstance := HInstance;<br> if Windows.RegisterClass(WindowClass) = 0 then<br> raise EOutOfResources.Create(SWindowClass);<br> end;<br> FHandle := CreateWindow(WindowClass.lpszClassName, PChar(FTitle),<br> WS_POPUP or WS_CAPTION or WS_CLIPSIBLINGS or WS_SYSMENU<br> or WS_MINIMIZEBOX,////////////////////////////////////使用<br> GetSystemMetrics(SM_CXSCREEN) div 2,<br> GetSystemMetrics(SM_CYSCREEN) div 2,<br> 0, 0, 0, 0, HInstance, nil);<br> FTitle := '';<br> FHandleCreated := True;<br> SetWindowLong(FHandle, GWL_WNDPROC, Longint(FObjectInstance));<br> if NewStyleControls then<br> begin<br> SendMessage(FHandle, WM_SETICON, 1, GetIconHandle);<br> SetClassLong(FHandle, GCL_HICON, GetIconHandle);<br> end;<br> SysMenu := GetSystemMenu(FHandle, False);<br> DeleteMenu(SysMenu, SC_MAXIMIZE, MF_BYCOMMAND);<br> DeleteMenu(SysMenu, SC_SIZE, MF_BYCOMMAND);<br> if NewStyleControls then DeleteMenu(SysMenu, SC_MOVE, MF_BYCOMMAND);<br> end;<br>end;<br>--------------------------<br>forms.pas源文件