Solved

Add a button to ALL Windows...

Posted on 2004-09-18
7
250 Views
Last Modified: 2013-11-20
As you know Windows on Microsoft Windows and some other popular OSs have a 'X' button in the uper right hand corrner, how can I add an extra button of that type to all the Windows?

Thank you for your time,
Arrummzen
0
Comment
Question by:Arrummzen
[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
7 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 400 total points
ID: 12094378
0
 
LVL 1

Author Comment

by:Arrummzen
ID: 12094609
Must I set up a hook for each Window? Can I somehow set up a hook that will capture ALL messages that go through Windows?

This is the code I have -
LRESULT WINAPI CALLBACK MyProc( int nCode, WPARAM wParam, LPARAM lParam )
{
      PCWPSTRUCT myData = (PCWPSTRUCT)lParam;

      if ( ctr < 10 )
      {      
            if( myData->message == WM_NCLBUTTONDBLCLK )
            {
                  ::Beep(3000,500);
                  ctr++;
            }
      }

      return CallNextHookEx( g_hHook, nCode, wParam, lParam );
}

Its capturing messages, but I never recieve the WM_NCLBUTTONDBLCLK message.
A: Why don't I recieve this message?
B: What must I do to recive this message?

Thank you for your time,
Arrummzen
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 12094662
I read this code long time ago and don't remember details. I remember only general idea: program installs WH_CBT hook to catch every new window. For each new window program installs WH_CALLWNDPROC hook to handle non-client messages.
0
 
LVL 1

Author Comment

by:Arrummzen
ID: 12094673
But if that is the case the program only works on newly created windows... I would like it to work on all Windows. I suppose I could look through all the open Windows and install the hook, but there should be a better way to do this...

Are you telling me that I must install a WH_CALLWNDPROC hook for each Window? I can't just install one hook for all Windows?

Thank you for your time,
Arrummzen
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 12094738
Well, now I see that code was changed from the time I read it. It doesn't use CBT hook.
If you are trying to catch WM_NCLBUTTONDBLCLK message for all windows, MyProc function should be placed in Dll - this is general requirement for all global hooks. This Dll is attached to every running process and executed in this process context. SetWindowsHookEx and UnhookWindowsHookEx should be called from this Dll.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

724 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