views:

32

answers:

2

Hi everyone,

In my VB6 project, I'm using only Toolbar Control in main MDI From (Not menubar), The Toolbar has big pictures denoting actions like New, Save, View, Help etc. I wanted to know if there is any way to create keyboard short-cut for these actions. As far as I know, properties of Toolbar control of MS Windows Common Controls 6.0 isn't showing any relative option to do this. As MDI form doesn't have any key events, I can't create short-cuts by associating keys as well. I don't want menu bar in my form as it has very few items so only Toolbar makes the job. Please suggest any idea to have short-cuts for toolbar buttons...... :-| Thanks in advance.............

A: 

Add a key event to your form. You could then process the short cuts by having them call the same function that would have been called on the mouse down event for the menubar.

For example you might have something like

public sub SaveItem_Clicked()
  DoSave()
end sub 

Then in your keypress check for Alt+S etc, and have it call DoSave()

taylonr
Ok, but when my application starts, it shows only main MDI form, which doesn't support any key event. So as the currently running MDI doesn't have any active child forms, and I want a short-cut (Eg; Ctrl+N) to launch the 'New' child form within MDI. As you suggested, I can use Ctrl+S to save changes made to the fields of 'New' window, as that form is a normal form and hence supports Key events, but How can I get short-cuts working with MDI form having only Toolbar with no child forms displayed....?
Kush
A: 

One way is to use a local WH_KEYBOARD hook, this article explains how (and provides a library).

Alex K.
Thanks a lot, that gave new possibilies to my project.... :-) But I'll be distributing my project under GNU GPL v3 and as I need to deploy vbalHook6.DLL along with the app, I'm not sure what is license terms of vbaccelerator.com. Its ok if I need to deploy my app under multiple licenses as I'll definitely give actual credit to respective authors.
Kush