|
Prev: Problem date comparision 2010
Next: Multimedia and internet keys of the keyboard not working underVO apps
From: René A. Meyer on 12 Jan 2010 07:21 Hi I still use VO 2.5b. A Bitmapcontrol should be linked with a corresponding Hotkey and trigger an Action in his Ownerwindow. So far, so good: Cerating a new Class inherited from Fixedbitmap and inherit my Bitmaps from this class, was easy. Initalizing the Bitmap in the Postinit of the Ownerwindow: SELF:oDCMyBitMap:SetBitMap(SELF:oBitMap, MOD_ALT, "R") // Hotkey ALT +R METHOD SetBitMap(oBitMap, nControl, uKey) CLASS MyBitmapclass Default(@nControl, 0) Default(@uKey, 0) // SELF:SetBitMap(oBitMap) // Shows the Bitmap SELF:RegisterKey(nControl, uKey) // Register the Hotkey if any RETURN NIL METHOD RegisterKey(nControl, uKey) CLASS MyBitmapclass LOCAL nID AS DWORD LOCAL lRet AS LOGIC LOCAL nKey AS DWORD // // nControl = 0 oder // MOD_ALT // MOD_CONTROL // MOD_SHIFT // IF UsualType(uKey) == STRING nKey := VkKeyScan(Asc(Lower(uKey))) ELSE nKey := uKey ENDIF lRet := FALSE // IF nKey <> 0 nID GlobalAddAtom(String2Psz(Symbol2String(SELF:NameSym))) IF RegisterHotKey(SELF:Handle(), nID, nControl, nKey) SELF:nAtomID := nID lRet := TRUE ENDIF ENDIF // RETURN lRet Of course a Dispatcher who receives the WM_HOTKEY-Message is also implemented in this Class, also a Destroy-Methode: METHOD Destroy() CLASS CLASS MyBitmapclass // IF SELF:nAtomID > 0 GlobalDeleteAtom(SELF:nAtomID) UnregisterHotKey(SELF:Handle(), SELF:nAtomID) ENDIF SUPER:Destroy() RETURN NIL So far everything works fine and perfect. But there is a rub in it! Assumed Outlook is open and the User uses ALT+R to answer a Email. Nothing happens as long my App is open. SDK-Help wasn't much use to me. How can i solve this Problem? Any Ideas? Late but not to late Happy New Year to all of you! René
From: Massimo Bighelli on 12 Jan 2010 09:38 Ren� IIRC, setting hotkey is a sort of global setting for windows you would unregister when your app looses focus... :-) Massimo Bighelli ARCA Sistemi S.r.l. www.arcasistemi.it www.arcasistemi.eu "Ren� A. Meyer" <rene.a.meyer(a)gmail.com> ha scritto nel messaggio news:c350a263-b0b4-4d0c-9db7-b494f73c2272(a)p24g2000yqm.googlegroups.com... Hi I still use VO 2.5b. A Bitmapcontrol should be linked with a corresponding Hotkey and trigger an Action in his Ownerwindow. So far, so good: Cerating a new Class inherited from Fixedbitmap and inherit my Bitmaps from this class, was easy. Initalizing the Bitmap in the Postinit of the Ownerwindow: SELF:oDCMyBitMap:SetBitMap(SELF:oBitMap, MOD_ALT, "R") // Hotkey ALT +R METHOD SetBitMap(oBitMap, nControl, uKey) CLASS MyBitmapclass Default(@nControl, 0) Default(@uKey, 0) // SELF:SetBitMap(oBitMap) // Shows the Bitmap SELF:RegisterKey(nControl, uKey) // Register the Hotkey if any RETURN NIL METHOD RegisterKey(nControl, uKey) CLASS MyBitmapclass LOCAL nID AS DWORD LOCAL lRet AS LOGIC LOCAL nKey AS DWORD // // nControl = 0 oder // MOD_ALT // MOD_CONTROL // MOD_SHIFT // IF UsualType(uKey) == STRING nKey := VkKeyScan(Asc(Lower(uKey))) ELSE nKey := uKey ENDIF lRet := FALSE // IF nKey <> 0 nID GlobalAddAtom(String2Psz(Symbol2String(SELF:NameSym))) IF RegisterHotKey(SELF:Handle(), nID, nControl, nKey) SELF:nAtomID := nID lRet := TRUE ENDIF ENDIF // RETURN lRet Of course a Dispatcher who receives the WM_HOTKEY-Message is also implemented in this Class, also a Destroy-Methode: METHOD Destroy() CLASS CLASS MyBitmapclass // IF SELF:nAtomID > 0 GlobalDeleteAtom(SELF:nAtomID) UnregisterHotKey(SELF:Handle(), SELF:nAtomID) ENDIF SUPER:Destroy() RETURN NIL So far everything works fine and perfect. But there is a rub in it! Assumed Outlook is open and the User uses ALT+R to answer a Email. Nothing happens as long my App is open. SDK-Help wasn't much use to me. How can i solve this Problem? Any Ideas? Late but not to late Happy New Year to all of you! Ren�
From: Geoff Schaller on 23 Jan 2010 21:11
Rene. Of course! You did register a hot key after all. Your implementation looks to be too invasive - I can't see any keyboard hook, which would be the normal way to do such things. But do you really need a hot key? Couldn't you just write a dispatch handler that detects the key you want in the window you want? Geoff > So far everything works fine and perfect. > But there is a rub in it! > Assumed Outlook is open and the User uses ALT+R to answer a Email. > Nothing happens as long my App is open. > > SDK-Help wasn't much use to me. > > > How can i solve this Problem? Any Ideas? > > Late but not to late > Happy New Year to all of you! > > Ren� |