Advertisement
TLama

Untitled

Sep 23rd, 2014
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.88 KB | None | 0 0
  1. [Code]
  2. const
  3.   SC_CLOSE = $F060;
  4.   MF_GRAYED = $00000001;
  5.   MF_BYCOMMAND = $00000000;
  6.  
  7. type
  8.   HMENU = THandle;
  9.  
  10. function GetSystemMenu(hWnd: HWND; bRevert: BOOL): HMENU;
  11.   external 'GetSystemMenu@user32.dll stdcall';
  12. function EnableMenuItem(hMenu: HMENU; uIDEnableItem: UINT; uEnable: UINT): BOOL;
  13.   external 'EnableMenuItem@user32.dll stdcall';
  14.  
  15. function EnableSystemMenuItem(MenuItem: UINT; Enable: Boolean): Boolean;
  16. var
  17.   Flags: UINT;
  18. begin
  19.   Flags := MF_BYCOMMAND or (Ord(not Enable) and MF_GRAYED);
  20.   Result := EnableMenuItem(GetSystemMenu(WizardForm.Handle, False), MenuItem, MF_BYCOMMAND or Flags);
  21. end;
  22.  
  23. // ...
  24.  
  25. var
  26.   ProgressPage: TOutputProgressWizardPage;
  27.  
  28. procedure CurPageChanged(CurPageID: Integer);
  29. begin
  30.   if CurPageID = ProgressPage.ID then
  31.   begin
  32.     EnableSystemMenuItem(SC_CLOSE, True);
  33.     WizardForm.CancelButton.Visible := True;
  34.   end;
  35. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement