-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.pas
41 lines (36 loc) · 1003 Bytes
/
main.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
program tiny_window;
{$i external.inc}
var
win : HWND;
msg: TMSG;
rc: trect = (left:0;top:0;Right:900;Bottom:620);
function WindowProc(Wnd: HWND; Msg: longword; WParam: longint; LParam: longint): longint; stdcall;
begin
case msg of
WM_CLOSE:
begin
PostQuitMessage(0);
Exit;
end;
WM_PAINT: begin
GetClientRect(Wnd,@rc);
FillRect(getdc(Wnd),rc,CreateSolidBrush($908080));
end;
end;
WindowProc := DefWindowProcA(Wnd, Msg, WParam, LParam);
end;
begin
win := CreateWindowExA(WS_EX_TOOLWINDOW,'static', 'MiniWin', WS_SYSMENU or WS_CAPTION, 100, 100, 900, 620, 0, 0, 0, nil);
SetWindowLongA(win, GWLP_WNDPROC, longword(@WindowProc));
ShowWindow(win, SW_SHOWDEFAULT);
repeat
if PeekMessageA(@msg, 0, 0, 0, PM_REMOVE) then
begin
TranslateMessage(msg);
DispatchMessageA(msg);
end else begin
sleep(16);
end;
until (msg.message = WM_QUIT);
DestroyWindow(win);
end.