Right-click menu on Win95 edit controls

Posted on 1998-04-05
Last Modified: 2013-12-03
I want to write a tool which modifies the standard right-click menu on all the edit controls in Win95. It is not described how to do that anywhere in the Microsoft docs. Can I do that?
Question by:skanade
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
LVL 15

Expert Comment

by:Tommy Hui
ID: 1412548
Yes, you need to write a system hook to subclass all of the windows that are of the classname EDIT. Then you need to catch WM_RBUTTONDOWN or WM_CONTEXTMENU to do what you want.

The idea is you need to write a system hook to catch all of the windows in the system. Then you need to subclass every EDIT window. Then you need to watch for specific messages.

Author Comment

ID: 1412549
System hook is an old method which would work in Windows 3.1 as well. But, it is rather complicated and doesn't exactly let me "modify" the context menu which alread exists. Besides, if I understand it correctly, subclassing solution is suitable only if I want to do it in my own application using the subclassed windows.

No, I am looking for a simpler solution similar to what Windows 95 provides for most of its context menus, called "shell extensions." In Shell extensions, the context menu already exists and you modify it. Don't they have an extension documented for the context menu on the Edit control?

Thanks for your help,
LVL 39

Expert Comment

ID: 1412550

If you monitor the registry when the user rightclicks in a normal edit window, the only things that are being called are the values HKCU\AppEvents\Schemes and HKCU\AppEvents\Schemes\Apps\.Default\MenuPopup\.Current and the key  HKCU\AppEvents\Schemes\Apps\.Default\MenuPopup\.Current\Active.

These properties are for the sound that's played when a user rightclicks a text control.

There are no other keys or values from the registry that are being called by rightclicking an edit window that might modify that menu.
I'm afraid you have to monitor the system for the messages thui points out. There are several smart ways to do that in a way it doesn't decrease the system's performance.

Regards, Abel
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

LVL 39

Expert Comment

ID: 1412551
Sorry, I was not completely correct.

My information supplies to WinNT. On Win95 NO registry key is being called.

Author Comment

ID: 1412552
Thanks, abel.

I think, I would like to reduce to 100 points (if possible?) and award them to Thui if he gives little more details as to which exact functions to call with what parameters to set up the system hooks. And, why does he think subclassing is necessary. All I need to know is that it is an EDIT class for that window handle to which the mouse event is going. Why subclass?
LVL 39

Expert Comment

ID: 1412553
You don't have to subclass, if at all possible. Just process the messages appropriately and you can create a beautifull r-click menu.

As far as I know it's not possible to reduce points. But don't worry, the question is still tough enough. To make a good hook procedure for something like this, is quite difficult, I think.
You asked for which functions to use. I don't what programming language you use, but if you have a good reference, use SetWindowHookEx to process the messages. If you don't have a good reference on it, I can supply you some sample code (or thui, if he still wants to answer, it was his idea to do it this way).

Regards, Abel
LVL 15

Accepted Solution

Tommy Hui earned 200 total points
ID: 1412554
You do not need to subclass the windows if you are hooking the messages. My mistake on that. If you are to use the hook, then all you need is to put your hook function into a DLL and use SetWindowsHook() or SetWindowsHookEx().

HHOOK SetWindowsHookEx(WH_MOUSE,
  lpfn,     // address of hook procedure: Must be DLL for system hooks
  hMod,    // handle of application instance
  0 // identity of thread to install hook for

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (, we saw how to put the Delete button back there where it belongs.  "Delete" is …
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question