Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

How Can I Define Shortcut Keys In MDI Main Form?

For regular form, I think I need to set the KeyPreview property to True. But for the MDI Main Form, there is no KeyPreview property. I have a toolbar on the MDI Main Form and want to assign shortcut key to each buttons in the toolbar.

By the way, how can I trap Ctrl+key in VB?

Never try that before in my career (hard to believe??? ) but now I have to do it as I am now facing a group of AS400 users who will never agree to use a mouse frequently!



View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Define Shortcut Keys In A Form
Hey guys.
I would like to have shortcut keys in form, for example, CTRL+B will call a procedure or a function I define.
The only way I've found to do so is to define a shortcut key to a menu.
The problem is, I don't want to have a menu in my form, and when I'm setting the menu Visible property to False the short-cut key no longer works.
Do you have any idea on how can I create a shortcut from anywhere in the form without menu or how to make it work even when the menu is invisible?
Thank you very much.

Access Keys Wont Work In Main Form
Hello all,

My access keys will work on my forms with the exception of the main form.

Any ideas as to why this is happening?

Form Menu Shortcut Keys
Hi, Ive been using the menu editor to add shortcut keys to menu items but i would like to add some extra combinations that arnt on the list such as Shift+Ctrl+S. I was thinking about using either Form_KeyPress or GetAsyncKeyState() to run the menu item's click event but how would i add the key combination to the menu item? Normally you get the text on the left and the shotcut keys on the right. Is it possible to add it in?

Is there a better way to raise the events than Form_KeyPress and GetAsyncKeyState()?

Arrow Shortcut Keys On All Controls In Form
Is there a way to write a code so that the arrow keys that are pressed will be applied to any control which is being selected on the form?

Define Application Shortcut Key
Sorry if this problem has been posted somewhere else, but I just couldn't find it.

I'm implementing a photo viewer, and want to create shortcut keys "ctrl -" and "ctrl +" for zoom in and zoom out functions. Since vb menu doesn't have these shortcut keys, I tried using the Form_KeyUp function. It works, but sometimes it fires the key command twice. I searched around and found this bug report in microsoft site:

Is there another way to implement this?

Can I Define A Custom Menu Shortcut?
The program I am working on has a few keystrokes that make using it easier. I'd like to list these in my menu beside the actual menu item. The problem that I have is that VB limits my choices for shortcuts, and I can't use 'space', 'period', 'left', etc. Does anyone know if I can something other than what VB allows in the menu editor?

Using Keyboar Keys/shortcut Keys
Hi to all,

I know that using the KeyPreview property of a form is a useful thing when you try to implement shortcut key or re-act to keyboard keys. But I'd really like to implement something that can react to the keys when a user presses a keyboard without using the KeyPreview property, KeyDown, KeyPress and KeyUp events.

Do I need to use the GetAsyncKeyProperty API value (correct me if that is not the right function spelling/name)? Should it be implemented inside a Timer's Timer event?

Like for example if trying to create a typing software and I would be happy if anyone could give me ideas on the keyboard area.

Thanks and god bless all!

Problems Showing The Main Form In Sub Main()

My application use a Sub Main() to loadup a slash screen, while I do some initialising work, and then loads up the main form with

The frmMain has lots of controls on it, some 3rd party, and also 2 userControls of my own.

One of my users has reported, that once the splash screen has been displayed, the app then just 'hangs' before frmMain is displayed. However, this works fine on many many other PCs.

I have lots of tracing in my app, and I can see that all the init stuff works, and it gets to the bit before it does the, but it never gets to the frmMaim_Load() event.

I have some tracing in the UserControls, and I see that both of these execute the Initialize, ReadProperties and ReSize events, but thats it.

I presume, that there is something wrong with one of the other 3rd party controls I'm using, and for some reason they are 'failing' in some way.

Does any one know of any tracing for other was to figure out what is going on between me issuing the .Show command, and the Load() event firing?

Thanks for you help,

Rob Donovan.

ProIV Resource Centre <a href=''></a>

Shortcut Keys In VB
How do I make "Enter" execute an action for a button in my program?


Shortcut Keys
When you have an executable on your desktop, if you go to its properties, then shortcut tab, you can make custom shortcut keys to start that application. Is there a way to do this throught code?

Shortcut Keys
is there a code for when a user presses 'alt + m' for example, an event will happen? thanx, sean

Shortcut Keys
Hi im working on my program and its a thing for my game and tyhe problem is in game i am too lazy to press alt tab and so on. is there a way for me that for example

if Ctrl + i then
if pressed hello then
if holded F12

This kind of stuff.. please help me....

Shortcut Keys
I have a toolbar form in my program, and when it has focus, the shortcuts which I have assigned to the menus in my main form do not work, because the main form does not detect them. The toolbar form is already subclassed, so I was hoping to be able to fix this just by sending the WM_KEYDOWN message to the main form. But this has no effect. Anyone know what I should be doing?

Shortcut Keys
how can i assign shortcut keys eg ctrl C to do the same work as clicking a button?

About Shortcut Keys!
i want to call another form when i press Alt+P, how can i do this?

i got two forms...

Shortcut Keys
Hey guys, just wanted to know how I could add a shortcut key for a button. Like when you press CTRL + 1 it would press the button. I need this to work if the program is minimized to the tray also. Thanks in advance.


Shortcut Keys In Vb

How can i set "shortcut keys" functionality to vb controls?

Thanx in advance.


Online Harry Potter Games

Shortcut Keys
Hi all..
How can I make shortcut keys on a form without have to make menus?
So that wherever the focus is on in the form (on a textbox or listbox or anything), when I press the shortcut keys, it does some code (a Sub I defined), just like the menus' shortcut keys.


Shortcut Keys
I am making a mp3 player but i want to make shortcut keys like :
CTRL+M is minimizing... how do i make this? the shortcut key that is

Shortcut Keys
how do i detect double keys, e.g. shift+h, or something like that

how do i combine the ascii code?

Shortcut Keys
well...once u get into internet ..with ur explorer press f1 u will get for "shortcut keys" in the index of the help....u will get the information u need!

Shortcut Keys For Message Box
Is it possible to add shortcuts within a message box? If so, how?

i.e. Yes No

Y would be underlined
N would be underlined
Both would be accessed like a normal shortcut key using the Alt key.

Ummmm, Shortcut Keys?
Sorry, i really should have just searched for this, but i didnt know what to search for! I want to know how to set a shortcut key combination so that a command in my prog can be executed.

For example when the user presses [ctrl]-[alt]-[x], a function is called, but i want to be able to recognize those keys even when my prog doesnt have focus.

Creating Shortcut Keys

I am currently developing an application and was wondering how to create a shortcut key which is accessible from any of the forms of my tool. Basicly, I want to register F12 to do a certain action. The user should be able to press F12 from each form and the action should execute.


Disabling Shortcut Keys
I'm there a way to disable shortcut keys (such as Ctrl-C, Ctrl-V, Ctrl-X) or assign them different commands?

PopupMenus && Shortcut Keys
I have a problem with using shortcut keys in a hidden menu.

I am using a label to popup up the menu when clicked. In the menu are shorcut keys for various things. They Don't work unless i make the menu Visible, which i don't want for esthetic reasons.

Anyway to make a non visible menu respond to Shortcut keys?

Shortcut Keys In MDI Environment
Hi, my project consist of a MDI Parent with a tool bar that display a MDI childs.. I want to have short cut keys to activate the button (ie. F1-F12, Ctrl+ keys) I was looking at the events for the MDI parent and can't find a KeyPress or KeyDown event.. Do I have to put code in every MDI child to interepret key presses?

Shortcut Keys In Program
How do I create shortcut key for various subroutines in my programs? It's like those you can set at the Menu Editor for menus, eg. Ctrl-A, F2, etc...

Shortcut Keys For Buttons And Are Just One Key (i.e. The Key
I made a calculator and I used the microsoft style of calculator. I used a label instead of a textbox so you wouldnt get the regular textbox things..anyways I have buttons and they all work. Now I would like it so that when I push a number on my keyboard the corresponding button number will activate and put that number into the label. Thanks to anyone who helps me with this . Keep it simple if at all possible to give me a chance to understand it , thanks.

Assign Shortcut Keys....
Can any one tell me how to assign Shortcut keys for a partical event..... Say i want to assign Shortcut key(Alt+B or B ) for click event of command button1
.... please reply soon.......

Menu Shortcut Keys
I have a vb6 app which contains menus setup in design mode. I may, at certain
points, require the existing menu to be sub-classed for different functionallity.
Sub-classing the menu and giving the appearance of the old menu (same caption
and position) is no problem. But if the old menu has a shortcut key associated
with it, and i subclass, then the user presses the shortcut combination,
the OLD menu code is called!! How do i get the existing shortcut key for
a menu and assign it to my subclassed menu?

Menu Shortcut Keys
I have a vb6 app which contains menus setup in design mode. I may, at certain
points, require the existing menu to be sub-classed for different functionallity.
Sub-classing the menu and giving the appearance of the old menu (same caption
and position) is no problem. But if the old menu has a shortcut key associated
with it, and i subclass, then the user presses the shortcut combination,
the OLD menu code is called!! How do i get the existing shortcut key for
a menu and assign it to my subclassed menu?

Shortcut Keys On Buttons
I have a problem with displaying graphics on the buttons. I put a button on the form, change the style to graphical, and associate the picture property to the relevant bitmap. The bitmap has the shortcut key in it. For example, the button's bitmap is "Apply" and "A" is the shortcut key. Now in the caption property, if I type "&A" then, change the font to the minimum font, a black dot or a small line appears. How do I resolve this problem?

Disabling Shortcut Keys
We have a function that takes a long time to process and once that function is run we want to disable everythiing on the form so they can't do anything until it's finished loading. We disabled the form but it seems the shortcut keys still work. How can we disable them all without going and disabling each and every menu item??


Assining 2 Shortcut Keys To The Same Menu
Greetings all!

Just want to know how could I assing 2 shortcut keys to the same menu item.

I tought about putting some code in the "KeyDown" event, but I am using MDIForms and this event is not there in the main MDIForm.

I also subclass the main MDIForm and try to catch the WM_KEYDOWN and WM_KEYUP message, but nothing happens.

Please help me on this.

Thank you and have a nice day!

Catching Shortcut Keys In A COM Addin

I am trying to catch a shortcut key combination in my COM addin for Excel, Word and PowerPoint. My application dores some processing before an Open and a Save action. So I created a COM addin that catches the menu clicks and responds to them. However, when a user selects CTRL-C otr CTRL-S, my COM addin is not triggered. Does anyone know how to trap those key events.

In a .dot/.xla/.ppa file this is done by something like Application.OnKey "^S","modMain.Save"
I need something similar for my Addin.


Custom Shortcut Keys (i.e. Ctrl+Q)
I need to create a shortcut for custom menu item in Outlook. I need it to be a shortcut using the control key like Ctrl+P (to print something) instead of a shortcut using the alt key like ALT-F (to go display the File menu). Please let me know if this isn't clear enough. I attached a print screen of the menu item that I need it for.

Shortcut Keys For Command Buttons?
I've read that if you set the 'Default' property of a Command Button to True it will be activated whenever you press Enter on the keyboard at anytime in a program, but it doesn't seem to work. Can anyone shed any light.


Shortcut Keys To A Minimized Program.
How do i reach my Command1.button on Form1 when the program is minimized? (not has focus)
Is it possible?

(Need to minimize while Bitblt a piture on the screen.)

How To Override System Shortcut Keys
hi friends,

i have a form with menu's undo , redo where i have given the shortcut keys as CRTL+Z, CTRL+Y respectively. but when i am using the menu the code is functioning perfectly but when i am using the shortcut key, it is not working fine. it is b'coz the system shortcut keys are getting executed when i press CTRL+Z.
can u help me how to override the system shortcut keys with the application shortcut keys.


Shortcut Keys Behaving Strangely
A SSTab control has 5 tabs. It houses many controls due to which the shortcut key for more than 1 control is the same.

The SSTab has a CheckBox & a CommandButton which reside in 2 different tabs. The shortcut key for the CheckBox is Alt+Z & that for the CommandButton is Alt+C. Alt+C happens to be the shortcut key for 5 controls but Alt+Z is the shortcut key for only the CheckBox.

When I press Alt+Z on the keyboard, strangely the focus alternates between the CheckBox & the CommandButton though Alt+Z is the shortcut key for only the CheckBox.

Pressing Alt+C correctly alternates between the 5 controls including the CommandButton which I have referred to the earlier para....that's OK but why is Alt+Z alternating between the CheckBox & the CommandButton though Alt+Z is the shortcut key for only the CheckBox?

Please note that I have assigned all the shortcut keys in the Properties dialog at design time.

App.exe.manifest Problems With Shortcut Keys
I added the exe.manifest file to make my apps buttons have the XP Look,.

The problem is the underlining on the caption of a button to show the shortcut does not show up when I am using the mouse.

eg if I click on the menu with the mouse the buttons on the form appear with an underline, otherwise they show without.

Has anyone had this problem and know a solution?

Using Shortcut Keys Not Available In Menu Editor
Is there any way to get access to shortcut keys that are not available from the list in the Menu Editor?

Do I need an API or subclassing or something?

I suppose I could just catch the keys myself, but then how would I display which key does what in the menus?

Very Urgent - Regarding Shortcut Keys In Menus
hi there,
i want to add a shortcut key to a menu item, extra than builtin one's (for eg. : Ctrl+Shift+L) . how would i do that and also be able to handle its events.

thanx in advance

Altering Shortcut Keys In Menu
I have a menu set up using the menu editor and have a shortcut key for one of the items of F6. I need to change this at run time to remove the F6 shortkey in certain circumstances.
Anyone know how to do this ?


Shortcut Keys Ctrl+Enter
Does any one know how to assign the shortcut keystroke "Ctrl+Enter" to a menu item? For example, if you have MS Outlook, the shortcut keystroke Ctrl+Enter applies to sending an email message. I can only get the default shortcuts that VB gives you in the Menu Editor.


Shortcut Keys Doing Strange Things
Hi All!

I have a reset button on a form.  If I CLICK the reset button, everything on the form is reset, including a datagrid.  However, I noticed while testing this morning that if I use the shortcut keys "ALT + S", everything on the form is reset EXCEPT the datagrid.  I have to hit "ALT + S" twice to get the datagrid to clear.

Has anyone ever experienced this kind of nonsense before?  I thought about capturing the keystroke combo on the form level and executing the cmdReset_Click event twice but don't know how to capture shortcut keystrokes.

ciao for niao!


American Motorcyclist Association

Catching Windows Shortcut Keys...
I'm writing a basic security program that gives the user a black screen until the correct password is entered. Nothing too fancy, but enough to prevent someone from opening my laptop while I'm in the next room and screwing around with my files.

It's working pretty well so far, but I haven't been able to figure out how to get around the use of the Windows Shortcut keys (Alt + F4, Alt + Tab, Ctrl + Esc, you know the drill).

What do you reccommend I try?

System Wide Shortcut Keys
Hi I'm writing a litle program and i need to use system wide shortcuts (keyboard hook)

I've looked and look and can't find what i'm looking for.

Can someone please give me an example of how to use "CTRL + T" to do something (lets say just display a msg)


Copyright 2005-08, All rights reserved