rendered paste bodyprogram Uinndow;
uses
Wintypes, messages;
var
button1,label1,font1,Handle: hwnd;
Hide: bool = true;
Function processar_mensagens(h:hwnd;m:cardinal;w:wparam;l:lparam):integer; stdcall;
begin
case m of
wm_close: postquitmessage(0);
wm_create: messagebox(handle, 'Oieeeee =P', 'WM_CREATE <-------', 64);
wm_command: if l = button1 then sendmessage(handle, wm_close, 0, 0);
end;
result := DefWindowProc(h, m, w, l);
end;
Procedure blink;
begin
if hide then begin showwindow(label1, sw_show); hide := false; end else begin showwindow(label1, sw_hide); hide := true; end;
end;
var
Tag: TagWndClassA;
Msg: TMSG;
begin
with tag do begin
style := CS_CLASSDC;
lpfnWndProc := @processar_mensagens;
hInstance := hinstance;
hIcon := loadicon(0, IDI_APPLICATION);
hCursor := loadcursor(0, IDC_ARROW);
hbrBackground := 16;
lpszClassName := 'MyClassName';
end;
registerclass(tag);
Handle := CreateWindow(tag.lpszClassName, 'Janela de exemplo', WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 200, 150, 0, 0, hinstance, nil);
if Handle = INVALID_HANDLE_VALUE then Halt;
Label1 := CreateWindow('static', 'Hmmm, Uma janelinha ;D', WS_CHILD, 8, 8, 180, 17, handle, 0, 0, nil);
Font1 := createfont(16, 6, 0, 0, 0, 1, 0, 0, 0, 3, 0, 3, 0, 'Courrier new');
Sendmessage(label1, wm_setfont, font1, 0);
settimer(handle, 1, 500, @blink);
button1 := createwindow('button', 'Sair', ws_visible or ws_child, 150, 90, 40, 20, handle, 0, 0, nil);
Sendmessage(button1, wm_setfont, font1, 0);
while getmessage(msg, 0, 0, 0) do begin
translatemessage(msg);
dispatchmessage(msg);
end;
end.