| View previous topic :: View next topic |
| Author |
Message |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Wed Sep 17, 2003 2:46 pm Post subject: Local Option for Hotkey |
|
|
Local Option for Hotkey
This one if possible makes the hotkey enabled app a good windows citizen.
One can work around by getting the current state of the dialog if it's a foreground window but still the hot key of a different app will be lost as VDS has already captured it.
I don't know if that is feasible if this is dependent on a third party component.
Also Hotkey needs that a dialog be shown for it to work.
(I used GetKeyState API in conjunction with window state (foreground or not to achieve this - under a timer) If built in function is possible that s nice. _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
jules Professional Member


Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Wed Sep 17, 2003 4:44 pm Post subject: |
|
|
VDS 5 implements global hotkeys only. I expect that a dialog has to be present for a reason.
You might be able to implement local hotkeys using OPTION MSGEVENT,$0102,WM_CHAR _________________ The Tech Pro
www.tech-pro.net |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Thu Sep 18, 2003 12:07 am Post subject: |
|
|
What you can do is check if the window is in focus in a loop, and if it is not,
use HOTKEY REMOVE and if it is in focus, use HOTKEY ADD so that it is only
a hotkey when your window is active.  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Thu Sep 18, 2003 4:12 am Post subject: |
|
|
Thanks Jules this message works with OPTION MSGEVENT
The W param contains the character code of the key pressed.
But I can use VkKeyScan to conver it to Virtual key code.
FF Good Idea Thanks only thing is timer will consume many more CPU cycles than the idea given by jules I think. _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Thu Sep 18, 2003 6:47 pm Post subject: |
|
|
Actually you're just fine with a timer. As long as you don't use a wait time
of zero it uses hardly any CPU time.  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
marty Professional Member


Joined: 10 May 2001 Posts: 789
|
Posted: Fri Sep 19, 2003 11:48 am Post subject: |
|
|
FF I like your idea... Simple and effective. I wanted to do that for a long time.
Thanks to Jules also...  |
|
| Back to top |
|
 |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Sun Jan 18, 2004 8:32 pm Post subject: |
|
|
Hi CodeScript,
Would it be possible for you to post an example of how to implement this so I can determine, locally, if the Return button has been pressed down?
Thanks,
- Boo
CodeScript wrote:
Thanks Jules this message works with OPTION MSGEVENT
The W param contains the character code of the key pressed.
But I can use VkKeyScan to conver it to Virtual key code.
FF Good Idea Thanks only thing is timer will consume many more CPU cycles than the idea given by jules I think.
_________________
Regards
- CodeScript
Want a few Advanced VDS 5 Source Codes? Please Visit
http://codescript.vdsworld.com |
|
| Back to top |
|
 |
Vic D'Elfant Past Contributor


Joined: 26 Jun 2002 Posts: 673 Location: The Netherlands
|
Posted: Mon Jan 19, 2004 11:05 am Post subject: |
|
|
Hey guys,
I thought there was a dll hotkey, global, <1> in the vdsdll28.dll Perhaps you could use that one
Regards,
Vic _________________ phpBB Development Team |
|
| Back to top |
|
 |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Mon Jan 19, 2004 5:20 pm Post subject: |
|
|
Hi Vic,
Yeppers, that is correct. I was worried about compatiability of the DLL with VDS 5.0. Anyway, yesterday I decided to try the vdskey.dll v.2.8.
So far so good. FYI: I needed a local hotkey, not a global one. In essence, I need the user to be able to enter a search query and then be able to hit the Enter key while the focus is still in the edit box.
Here is some sample code using OPTION MSGEVENT. Is there a better way of accomplishing this?
Cheers,
- Boo
| Code: |
#define function,keyboard
external vdskey.dll
OPTION MSGEVENT,$0102,WM_Enter
Rem Dialog would be here.
:evloop
wait event
goto @event()
:WM_Enter
%%Focus = @focus()
if @equal(@keyboard(Return),1)
goto wm_enter2
end
goto evloop
rem Check for cursor in query field.
:wm_enter2
if @equal(%%Focus,findedit)
goto findbutton
end
goto evloop
|
|
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1566
|
Posted: Mon Jan 19, 2004 5:26 pm Post subject: |
|
|
| You can place a BUTTON on your dialog either visible or hidden and give it a DEFAULT style. When someone presses the ENTER key that button is always executed. |
|
| Back to top |
|
 |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Mon Jan 19, 2004 7:38 pm Post subject: |
|
|
Cool; thanks! (Duh!)
I knew there must be an easier way...  |
|
| Back to top |
|
 |
|