在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
首先新建一个工程,不用单元,把窗口关掉,我们用WINDOWS API函数来创建一个窗口。 program Project1; uses Windows,Messages; function WindowProc(HWndow:HWND;msg,wparam,lparam:UINT):UINT;stdcall; begin case msg of WM_DESTROY: begin PostQuitMessage(0); end; end; Result:=DefWindowProc(HWndow,msg,wparam,lparam); end; var hWindow:HWND; message:TMsg; wndclass:TWndClass; begin wndclass.style:=CS_HREDRAW or CS_VREDRAW; wndclass.lpfnWndProc:=@WindowProc; wndclass.cbClsExtra:=0; wndclass.cbWndExtra:=0; wndclass.hInstance:=HInstance; wndclass.hIcon:=LoadIcon(0,IDI_APPLICATION); wndclass.hCursor:=LoadCursor(0,IDC_ARROW); wndclass.hbrBackground:=COLOR_WINDOW; wndclass.lpszMenuName:=nil; wndclass.lpszClassName:='MyWindow'; RegisterClass(wndclass); hwindow:=CreateWindowEx(0,'MyWindow','我的窗口',WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT, 0,0,HInstance,nil); if hWindow <> 0 then begin ShowWindow(hWindow,SW_SHOWNORMAL); UpdateWindow(hWindow); end; while GetMessage(message,0,0,0) do begin TranslateMessage(message); DispatchMessage(message); end; end. 试着运行一下看看~~。 |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论