Ne znam baš koliko zadovoljsto će ti biti da pišeš ručno Evo... ovo je primer kreiranja praznog prozora koji ne radi bukvalno ništa, a ti zamisli koliko tek treba da pišeš samo da bi dodao jedno dugme koje samo zatvara prozor
program WinTut;
uses
Windows, Messages;
var
WndClass: TWNDClassEx;
Wnd: HWnd;
Msg: TMsg;
function WndProc(Wnd: HWnd; Msg: UINT;
wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
begin
case Msg of
WM_DESTROY:
begin
PostQuitMessage(0);
Result:= 0;
end
else
Result:= DefWindowProc(Wnd, Msg, wParam, lParam);
end;
end;
begin
WndClass.cbSize := SizeOf(WndClass);
WndClass.style := CS_HREDRAW or CS_VREDRAW;
WndClass.lpfnWndProc := @WndProc;
WndClass.cbClsExtra := 0;
WndClass.cbWndExtra := 0;
WndClass.hInstance := HInstance;
WndClass.hIcon := LoadIcon(0, IDI_APPLICATION);
WndClass.hCursor := LoadCursor(0, IDC_ARROW);
WndClass.hbrBackground := COLOR_BTNFACE + 1;
WndClass.lpszMenuName := nil;
WndClass.lpszClassName := 'MojProzor';
WndClass.hIconSm := 0;
RegisterClassEx(WndClass);
Wnd := CreateWindowEx(
WS_EX_OVERLAPPEDWINDOW,
'MojProzor',
'Prozor bez VCL',
WS_OVERLAPPEDWINDOW,
100, 100, 400, 300,
0,
0,
HInstance,
nil
);
ShowWindow(Wnd, SW_SHOWDEFAULT);
UpdateWindow(Wnd);
while GetMessage(Msg, 0, 0, 0) do
DispatchMessage(Msg);
UnregisterClass('MojProzor',HInstance);
end.
|