Prevent a minimized window from restoring until a password is given (Views: 31)
Problem/Question/Abstract: I would like to have a password for windows I minimize. How can I write an application that will prevent any minimized window from restoring until a password is given? Answer: interface part: bPassWordDialog: Boolean; procedure WMSYSCOMMAND(var Msg: TWMSysCommand); message WM_SYSCOMMAND; procedure WMActivate(var Msg: TWMActivate); message WM_ACTIVATE; implementation part: procedure TForm1.WMActivate(var Msg: TWMActivate); begin if (Msg.Active = WA_Active) and (bPassWordDialog) then begin bPassWordDialog := False; ShowMessage('Show password dialog here'); end; inherited; end; procedure TForm1.WMSYSCOMMAND(var Msg: TWMSysCommand); begin bPassWordDialog := False; if Msg.CmdType = SC_MINIMIZE then bPassWordDialog := True; inherited; end; |