Solved

Add a button to ALL Windows...

Posted on 2004-09-18
7
243 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

Technology Partners: 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

Suggested Solutions

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

749 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