473,544 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help for Ctrl-Tab Hot Key

I have set up a hotkey using RegisterHotKey API function for Ctrl-Tab.

Firstly, I can rap this when Ctrl-Tab is pressed however if I want to
add an addition hotkey how can I distinguish between which hotkey was
pressed?

Secondly I am trying to replicate the Ctrl-Tab functionality you have
in the DotNet IDE when you hold down the Ctrl key and then additional
use the tab key you can cycle thru the MDI Children. I would like to
gain the same functionality but don't know how to catch the initial
Ctrl Key down and then Ctrl Key up and then also catch when the tab
key has been pressed?

Really appreciate any ideas.

Thanks
Nov 16 '05 #1
3 7085
Wes
Hello Glen, (Comments inline)
I have set up a hotkey using RegisterHotKey API function for Ctrl-Tab.

Firstly, I can rap this when Ctrl-Tab is pressed however if I want to
add an addition hotkey how can I distinguish between which hotkey was
pressed?
The second parameter to RegisterHotKey is an ID for that particular hotkey. Just give different IDs for different hotkeys and when you get the WM_HOTKEY message check the lParam for the particular ID of the hotkey and do the action for the appropriate hotkey.
Secondly I am trying to replicate the Ctrl-Tab functionality you have
in the DotNet IDE when you hold down the Ctrl key and then additional
use the tab key you can cycle thru the MDI Children. I would like to
gain the same functionality but don't know how to catch the initial
Ctrl Key down and then Ctrl Key up and then also catch when the tab
key has been pressed?


Since CTRL is a modifier key you can't capture that alone as a hotkey however it should trigger your hotkey when each time the user is holding the CTRL key and hits the Tab key. i.e. Hold CTRL hit Tab, Triggers Hotkey, Still Holding CTRL but release Tab, and then Press Tab again it should Trigger the Hotkey again.

HTH
Wes Haggard
http://weblogs.asp.net/whaggard/
Nov 16 '05 #2
Hi Wes,

Thanks for the reply! What you have said does work, unfortunately
there is a need to realise when the ctrl tab has been released. When
you hold down the ctrl key you continue to cycle thru the mdi
children. Whenever you release the ctrl key the cycling finishes and
the mdi list is then rearranged.

Do you think there is a way of doing this? Also I think I have just
discovered that the RegisterHotKey function registers that hot key for
all of windows. i.e. Even applies when the application does not have
the focus. Is there a way of registering a hotkey for an application
only when it has the focus??

Thanks
Nov 16 '05 #3
Wes
Hello Glen,
Hi Wes,

Thanks for the reply! What you have said does work, unfortunately
there is a need to realise when the ctrl tab has been released. When
you hold down the ctrl key you continue to cycle thru the mdi
children. Whenever you release the ctrl key the cycling finishes and
the mdi list is then rearranged.

Do you think there is a way of doing this? Also I think I have just
discovered that the RegisterHotKey function registers that hot key for
all of windows. i.e. Even applies when the application does not have
the focus. Is there a way of registering a hotkey for an application
only when it has the focus??


You are correct RegisterHotkey registers a global hotkey so your application doesn't have to be active to get the hotkey. I'm assuming you are using WinForms and if so you could easily either override the KeyUp/KeyDown events to do what you want.

So you could do something like:

protected override OnKeyDown(KeyEv entArgs e)
{
if(e.KeyCode == Keys.Tab && e.Control)
// Cycle through windows, i.e. move to next window

base.OnKeyDown( e);
}

If I'm understanding what you are trying to do I believe that will do it.

HTH
Wes Haggard
http://weblogs.asp.net/whaggard/
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
13950
by: Scott | last post by:
I am using a TCPIP connection to communicate over port 23 (telnet) to a server, and I am having to mimic normal command line interface you owuld see in a telnet session (i.e. I have to write to this socket just like you would enter things on the keyboard if you telneted to this server). In a normal telnet session you can enter some commands...
5
5898
by: Greg | last post by:
I am developing an application where I need to secure a workstation for periods of time. I can use BlockInput to stop users from task switching or messing with the keyboard, but I would like to disable Ctrl-Alt-Delete. It seems there seems to be only one real way I know about: Write a replacement Gina Driver to eat the keyboard events I...
1
1581
by: Stefan W via .NET 247 | last post by:
I'm relatively new to C#, (I have to use it, now that I'veinherited someone else's projects). I'm looking for a way toiterate through the controls on a form; if the control is of acertain type, I want to set a property that is specific to thatcontrol type. The problem I'm having is that the "generic"Control object might not contain the...
2
2864
by: crjunk | last post by:
I'm trying to write a piece of code that will programatically save a record automatically without me having to add a new ' Row.Item("ADD1") = txtAdd1.Text.Trim.ToUpper ' type command each time I add a new textbox. I've named all my textboxes in the following format txtAdd1 and I've named all my field in the SQL table the same way minus the...
3
1256
by: Eirik Eldorsen | last post by:
I'm tring to translate an VB.NET method into C#. Here is what I've done so far. Need help on the while loop public static void SetInitialFocus(Control ctrl) { StringBuilder s = new StringBuilder(); s.Append("<SCRIPT LANGUAGE='JavaScript'>"); s.Append("function SetInitialFocus()"); s.Append("{"); s.Append(" document.");
2
8623
by: s99999999s2003 | last post by:
hi i have a program that works very similar to tail -f in Unix It will need a Ctrl-C in order to break out of the program. I wish to run this program using python (either thru os.system() or some other subprocess modules) and how can i pass Ctrl-C to this program to terminate it in python? thanks
11
2236
by: Bookham Measures | last post by:
Hello As above, my Ctrl + Spacebar for intellisense is not working in VI 6.0. I have checked keyboard assignments and Ctrl + Space is listed for Edit -> CompleteWord. I added Ctrl + Shift + Space and that does work, but Ctrl + Space does not. I removed Ctrl + Space thinking re-adding it might help, but now the
6
4706
by: Ronald S. Cook | last post by:
We have a Windows app that has one main form (a shell, sort of). We then load user controls into a panel on the form depending on what the user has selected. Our current code to unload the existing user control and load the newly selected one is pretty bulky. Every time we add a new user control to the project, we have to add some code in...
1
4693
by: lolly | last post by:
hi i recently used a virtual keyboard from www.codeproject.com/jscript/jvk.asp. However this part of the code function keyb_callback(ch) { var text = document.getElementById("textfield"), val = text.value; switch(ch) { case "BackSpace":
4
1886
by: adam_kroger | last post by:
BRIEF EXPLANATION: I have 6 TextBoxes named LIS1, LIS2, LIS3, ... LIS6. I want to be able to reference them using a For/Next loop and either read ot write to them. In VBA I would use something like this: for i = 1 to 6 me.controls("LIS" & i).Value = "" next i Nedless to say, the Controls("LIS" & i).text doesn't work...
0
7373
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7625
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7389
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7717
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5306
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3427
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
677
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.