IBM developerWorks
           Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 14th, 2003, 04:06 PM
csaba csaba is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: NYC
Posts: 79 csaba User rank is Private First Class (20 - 50 Reputation Level)csaba User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
determining a menu's accelerator key

Given a menu object in VB, I'd like to determine the accelerator key (shortcut), if any, that the menu object uses.

For every menu command on my form in my (VB5) OCX, I need to call my own saveState routine exactly once. I can subclass the form's Window Proc testing for WM_COMMAND and lParam=0 and the high word of wParam being 0 (which indicates a menu command being invoked). The low word of wParam then contains the (1 based) menu "number" for the selected menu command. However, if the menu command is invoked via an accelerator (Ctrl+acceleratorKey) then no WM_COMMAND is sent. For these situations, I will put the call to saveState directly in the menu command (..._Click event), but then I should bypass the call in the subclassed form's Window Proc.

That's why I want to determine the accelerators on my menus programatically (but it's an interesting question anyway).

Starter code:

idx = 0
Set dctMenus = New Dictionary
For each ctrl in myForm.Controls
If Typename(ctrl) = "Menu" Then
idx = idx + 1
dctMenus.Add idx, Array(ctrl, "accelerator key information goes here")
End If
Next

Thanks,
Csaba

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > determining a menu's accelerator key


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway