troubleshooting Question

Shortcut in menubar

Avatar of dgb
dgb asked on
Visual Basic Classic
12 Comments1 Solution474 ViewsLast Modified:
I am trying to add shortcuts to an exsisting menu.
Below is an example of the code (wich doesn't work)
Maybe someone can make it work or has suggestions.

I am not looking for something with the keydown of the form.


'****************START SOURCE*************************
MoveMemory Mnu, ByVal ObjPtr(MenuObject), Len(Mnu)
   
    ' Only non popup items can have a shortcut
If Mnu.lpFirstItem > 0 Then
   
   If NewShortcut > vbAltBackspace Then
      NewShortcut = vbAltBackspace
   ElseIf NewShortcut < 0 Then
      NewShortcut = vbNoShortcut
   End If
       
   Mnu.wShortcut = NewShortcut
       
   ' Change only that value
   
   MoveMemory ByVal ObjPtr(MenuObject) + 242, Mnu.wShortcut, 2
   ' Set the caption to update
   ' the shortcut text
   MenuObject.Caption = MenuObject.Caption
       
End If

'****************END SOURCE***************************

ASKER CERTIFIED SOLUTION
Ark

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros