Solved

Right-click menu on Win95 edit controls

Posted on 1998-04-05
7
271 Views
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?
Thanks,
Sanjay
0
Comment
Question by:skanade
  • 3
  • 2
  • 2
7 Comments
 
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.
0
 

Author Comment

by:skanade
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,
Sanjay
0
 
LVL 39

Expert Comment

by:abel
ID: 1412550
Sanjay,

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
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 39

Expert Comment

by:abel
ID: 1412551
Sorry, I was not completely correct.

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

Author Comment

by:skanade
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?
0
 
LVL 39

Expert Comment

by:abel
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
0
 
LVL 15

Accepted Solution

by:
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
);
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

825 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