Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keyboard Shortcuts To Menu

Status
Not open for further replies.

Yesca

Programmer
Mar 19, 2002
20
CA
How would I set a menu's shortcut key at run-time to jump to a procedure in an external object?

Here's my problem:
I'm currently in the process of breaking a rather large application (30+ megs compiled .exe) in vb6 to smaller, more manageable chunks (dll's and ocx's). Now, I have a small routine which allows for existing menu steps to be subclassed to call an external object, essentially "overwritting" the "click" event on the menu to not call the old code, but jump into the external. Now, this all works fine and dandy, except when the menu step originally has a shortcut key (ctrl-e, for example) associated with it. Even after my subclassing stuff, the shortcut key combination calls the old code.

So i need to re-assign what a shortcut key combination calls. Anybody know how this is done?
 
You shouldn't be trying to capture the keys to runn your DLL's What you should do is change the menu click event

Private sub mnuFile()

Call MyFunction(Parameters)
Dim objMyFunction as MyDLL.MyFunction

Set objMyFunction = CreateObject("MyDLL.MyFunction")
objMyFunction.StartUpFunction
End Sub

Is this what you were asking. Craig, mailto:sander@cogeco.ca

"Procrastination is the art of keeping up with yesterday."

I hope my post was helpful!!!
 
Well, here's the thing. Say for example I have, in my main application a menu "Something" with the shortcut Ctrl-S associated with it.

Code:
Sub mnuSomething_Click()
  :
  :
  ' Do some stuff
  :
  :
End Sub

Now, down the line, i decide to enhance the functionality of this menu step, so i write an ActiveX DLL which has the capabilities to replace that menu step (using the RemoveMenu the InsertMenu api calls). So i now have an existing, working call within the main app for the mnuSomething, and I also have a updated call available by just reigstering a DLL. This all works fine so far. I have no issues there.

What happens, though, if the user has the update DLL installed/registered and simply clicks the menu, no problem. New call is made. Updated functionality supported. But if the user uses the Ctrl-S combination, the OLD code is called. I need to re-assing the Ctrl-S combination, when hooking the menu to call the new function in the DLL.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top