Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Code]
- const
- SC_CLOSE = $F060;
- MF_GRAYED = $00000001;
- MF_BYCOMMAND = $00000000;
- type
- HMENU = THandle;
- function GetSystemMenu(hWnd: HWND; bRevert: BOOL): HMENU;
- external 'GetSystemMenu@user32.dll stdcall';
- function EnableMenuItem(hMenu: HMENU; uIDEnableItem: UINT; uEnable: UINT): BOOL;
- external 'EnableMenuItem@user32.dll stdcall';
- function EnableSystemMenuItem(MenuItem: UINT; Enable: Boolean): Boolean;
- var
- Flags: UINT;
- begin
- Flags := MF_BYCOMMAND or (Ord(not Enable) and MF_GRAYED);
- Result := EnableMenuItem(GetSystemMenu(WizardForm.Handle, False), MenuItem, MF_BYCOMMAND or Flags);
- end;
- // ...
- var
- ProgressPage: TOutputProgressWizardPage;
- procedure CurPageChanged(CurPageID: Integer);
- begin
- if CurPageID = ProgressPage.ID then
- begin
- EnableSystemMenuItem(SC_CLOSE, True);
- WizardForm.CancelButton.Visible := True;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement