uses
Windows, Messages;
var
C: TWndClass;
H: hWnd;
A: THandle;
M: TMsg;
const acc: array [0 .. 2] of word = (fVirtKey or fAlt, vk_Return, 1);
function WP(H: hWnd; M: uInt; W: wParam; L: lParam): longint; stdcall;
begin
Result := 0;
case M of
wm_Command: begin
case LoWord(W) of
1: begin
if IsZoomed(H) then begin
ShowWindow(H, sw_Restore);
SetWindowLong(H, gwl_Style, ws_OverlappedWindow or ws_Visible); вот в этом месте!!!
end else begin
SetWindowLong(H, gwl_Style, integer(ws_PopUp or ws_Visible));
ShowWindow(H, sw_ShowMaximized);
end;
end;
end;
end;
wm_Destroy: begin
PostQuitMessage(0);
Exit;
end;
end;
Result := DefWindowProc(H, M, W, L);
end;
begin
with C do begin
Style := cs_HRedraw or cs_VRedraw or cs_OwnDC;
lpfnWndProc := @WP;
cbClsExtra := 0;
cbWndExtra := 0;
hInstance := MainInstance;
hIcon := 0;
hCursor := LoadCursor(0, idc_Arrow);
hbrBackground := Color_BtnFace + 1;
lpszMenuName := nil;
lpszClassName := 'test';
end;
RegisterClass©;
A := CreateAcceleratorTable(acc, 1);
H := CreateWindow('test', 'test', ws_OverlappedWindow or ws_Visible, 100, 100, 400, 300, 0, 0, MainInstance, nil);
ShowWindow(H, cmdShow);
UpdateWindow(H);
while GetMessage(M, 0, 0, 0) do begin
if TranslateAccelerator(H, A, M) = 0 then begin
TranslateMessage(M);
DispatchMessage(M);
end;
end;
end.
Не восстанавливается рамка окна, WinAPI |