Bila sebuah aplikasi berada pada posisi minimze di tray icon dan kita ingin restore aplikasi dengan short cut "Alt-Shift-F9" agar berada pada posisi aktif form. berikut contohnya :
~~~~~~~~~~~~~~~~~~~~~~~~~
//In the main forms OnCreate
//handler assign the hotkey:
If not RegisterHotkey
(Handle, 1, MOD_ALT or MOD_SHIFT, VK_F9) Then
ShowMessage('Unable to assign Alt-Shift-F9 as hotkey.') ;
//In the main forms
//OnClose event remove the handler:
UnRegisterHotkey( Handle, 1 ) ;
//Add a handler for the
//WM_HOTKEY message to the form:
private // form declaration
Procedure WMHotkey( Var msg: TWMHotkey ) ;
message WM_HOTKEY;
Procedure TForm1.WMHotkey( Var msg: TWMHotkey ) ;
Begin
__If msg.hotkey = 1 Then
__Begin
____ If IsIconic( Application.Handle ) Then
______Application.Restore;
____BringToFront;
__End;
End;
~~~~~~~~~~~~~~~~~~~~~~~~~
No comments:
Post a Comment