Based on the previous introduction, you can create a window:
Program project1; uses Windows, messages; {window callback function, which must be declared Program Front} function wndproc (WND: hwnd; MSG: uint; wparam: integer; lparam: integer): integer; stdcall; begin result: = 0; if MSG = wm_destroy then {when the window is destroyed} postquitmessage (0) {tell getmessage: Exit !} Else result: = defwindowproc (WND, MSG, wparam, lparam); {other messages are processed by default} end; {main program} var hwnd: thandle; MSG: tmsg; mywndclass: twndclass; begin {specify window type} mywndclass. style: = cs_hredraw or cs_vredraw; {re-paint after changing the size} mywndclass. lpfnwndproc: = @ wndproc; {callback function pointer} mywndclass. cbclsextra: = 0; {No additional window class information} mywndclass. cbwndextra: = 0; {No additional window information} mywndclass. hinstance: = hinstance; {program instance handle} mywndclass. hicon: = 0; {No icon specified} mywndclass. hcursor: = loadcursor (0, idc_arrow); {the pointer provided by the system is selected} mywndclass. hbrbackground: = hbrush (color_window + 1); {the background color uses the Windows Default window color} mywndclass. lpszmenuname: = nil; {default menu not specified} mywndclass. lpszclassname: = 'mywindowclass'; {name the window type} {register the window type} registerclass (mywndclass); {create a window and return a handle} hwnd: = createwindow ('mywindowclass ', {window type name} 'new Window', {Title} ws_overlappedwindow, {General window style} INTEGER (cw_usedefault), {default horizontal position} INTEGER (cw_usedefault ), {default vertical position} INTEGER (cw_usedefault), {default width} INTEGER (cw_usedefault), {default height} 0, {No parent window} 0, {No Main Menu} hinstance, {instance handle} nil {no additional information}); {display window} showwindow (hwnd, sw_shownormal); // updatewindow (hwnd ); {do you want to update the window?} {message loop} while (getmessage (MSG, 0, 0, 0) do begin translatemessage (MSG ); {reprocessing of some keyboard messages} dispatchmessage (MSG); {send the message to the callback function} end; end.
Then we will continue to improve theseCode!