Solved

Appending the system menu of other windows

Posted on 2009-05-15
2
594 Views
Last Modified: 2012-05-07
I'm writing a program that allows the user to change the priority of the process from the system menu of any window owned by that process. I can add the menu item easily using the AppendMenu or InsertMenuItem APIs from user32, but the WndProc method doesn't catch anything with windows outside my own application
 If I click my menu item that was added to my program's form's system menu, then it raises the event properly. I'm guessing I need to use subclassing (I've seen someone use GetWindowLong) to do this properly, but I can't figure it out.

Any ideas?
Thanks in advance,
Graham
0
Comment
Question by:burningmace
[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
2 Comments
 
LVL 11

Accepted Solution

by:
PlatoConsultant earned 500 total points
ID: 24405382
normally windows get the messages for the current windows only. Here is a sample at code project that will tell you how to catch all messages from other windows...

 

Using Window Messages to Implement Global System Hooks in C#


http://www.codeproject.com/KB/system/WilsonSystemGlobalHooks.aspx



if (GetProp(GetDesktopWindow(), "WILSON_HOOK_HWND_CBT") != NULL)
{
  SendNotifyMessage((HWND)GetProp(GetDesktopWindow(), 
      "WILSON_HOOK_HWND_CBT"), 
      RegisterWindowMessage("WILSON_HOOK_CBT_REPLACED"), 0, 0);
}
 
SetProp(GetDesktopWindow(), "WILSON_HOOK_HWND_CBT", destination);

Open in new window

0
 
LVL 5

Author Comment

by:burningmace
ID: 24405405
Thanks. I'll try it out tonight when I get home from work.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

730 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