Solved

Right-click menu on Win95 edit controls

Posted on 1998-04-05
7
274 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
[X]
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
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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

623 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