?
Solved

Add a button to ALL Windows...

Posted on 2004-09-18
7
Medium Priority
?
259 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 1600 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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 course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Suggested Courses

649 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