How to have "Ctrl + +" added into the menu item in VB

How to have "Ctrl + +" added into the menu item in VB

Post by Randy Birc » Fri, 05 Apr 2002 09:58:01



(trimmed to appropriate groups)

You could use RegisterHotKey ... see
http://www.mvps.org/vbnet/code/subclass/registerhotkey.htm

Specify MOD_CONTROL as the modifier, and 187 for the + sign, and 189 for the
minus, ie ...

  Call RegisterHotKey(Me.hWnd, GlobalAtom.Value, MOD_CONTROL, 187)
  Call RegisterHotKey(Me.hWnd, GlobalAtom.Value, MOD_CONTROL, 189)

You'll need to do some additional work as the demo only shows trapping a
single hotkey. Also notice that this installs a system-wide hotkey, so
pressing CTRL +/- while in another app will invoke the code in your app.
Therefore you may want to add additional code to deregister the keys when
focus moves from your app to another (
http://www.mvps.org/vbnet/code/subclass/activation.htm )

There is also SetMenuItemInfo() and set
CreateAcceleratorTable/DestroyAcceleratorTable that provides for modifying
the text and adding menu/keyboard accellerators to an app ... but I don't
have demos for those (try searching www.codehound.com/vb/ )

--

Randy Birch
MVP Visual Basic

http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.


> I wanted to add Ctrl + + (Plus sign)  in the shortcut for Zooming In and
> Ctrl + - (Minus sign) in the shortcut for Zooming Out for a form in the
> menu Item. The menu editor does not support Plus/Minus sign. If any one
> can help, please let me know.

> Rupesh Kokal.

 
 
 

How to have "Ctrl + +" added into the menu item in VB

Post by Rupesh Koka » Wed, 10 Apr 2002 20:52:12


I have tried using RegisterHotKey. It works but there are many problems using hook in the application. Some times the application crashes.

Information for SetMenuItemInfo API is not given perfectly regarding the assignment for the short cut to the menu item.

If any one can help let me know.

Rupesh Kokal.

  (trimmed to appropriate groups)

  You could use RegisterHotKey ... see
  http://www.mvps.org/vbnet/code/subclass/registerhotkey.htm

  Specify MOD_CONTROL as the modifier, and 187 for the + sign, and 189 for the
  minus, ie ...

    Call RegisterHotKey(Me.hWnd, GlobalAtom.Value, MOD_CONTROL, 187)
    Call RegisterHotKey(Me.hWnd, GlobalAtom.Value, MOD_CONTROL, 189)

  You'll need to do some additional work as the demo only shows trapping a
  single hotkey. Also notice that this installs a system-wide hotkey, so
  pressing CTRL +/- while in another app will invoke the code in your app.
  Therefore you may want to add additional code to deregister the keys when
  focus moves from your app to another (
  http://www.mvps.org/vbnet/code/subclass/activation.htm )

  There is also SetMenuItemInfo() and set
  CreateAcceleratorTable/DestroyAcceleratorTable that provides for modifying
  the text and adding menu/keyboard accellerators to an app ... but I don't
  have demos for those (try searching www.codehound.com/vb/ )

  --

  Randy Birch
  MVP Visual Basic

  http://www.mvps.org/vbnet/
  Please respond only to the newsgroups so all can benefit.


  > I wanted to add Ctrl + + (Plus sign)  in the shortcut for Zooming In and
  > Ctrl + - (Minus sign) in the shortcut for Zooming Out for a form in the
  > menu Item. The menu editor does not support Plus/Minus sign. If any one
  > can help, please let me know.
  >
  >
  > Rupesh Kokal.

 
 
 

1. Windows 3.1 File Manager - How to add "EDIT" as menu item?

I'm looking for some way to modify the Windows 3.1 file manager and
add new menu items...

        1. EDIT - with the editor of my choice if possible

        2. PRINT - but this needs to not be associated with the 'notepad'
           or whatever... else you have to have all the 'associations'
           for the file type already setup. ie, I want to be able to
           print test.bat.

Another alternative would be a replacement for Window filemanager that
is tricked... any ideas?

---
Kim B. Cooper
Corporate Network Management and UNIX System Administration
Office (214) 715-4534   FAX (214) 715-4555
Oryx Energy Company
13155 Noel Road
Dallas, TX 75240-5067 USA

2. Rekroom

3. Items Added to "All Users" Folder Do Not Appear on the Start Menu

4. Compaq Insight Manager causing broadcast storms ?

5. Add Item to "start" menu

6. Chat sounds

7. List control: item "position" vs. "index" question

8. COURSE: High Level Design Using Verilog, Beaverton, Oregon

9. "own" vs "uses" vs "contains" vs "is a"

10. How to add "faves" to all "OPEN" dialogs?

11. how to write "sizeof" and "calloc" in VB for my caller ID

12. adding item to IE's "Standard Buttons" bar

13. Integration of MSDN Search Engine into "ma_app.vb" or "my_app.c++"