Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language

Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

C# Programming

Find Mouse Clicks (When App isn't Focused)

I want to be able to tell when the mouse left clicks even when my
application doesn't have focus.

I tried adding this to my form
        protected override void WndProc(ref Message m) {
            if(m.Msg == WM_NCLBUTTONDOWN) {
                System.Windows.Forms.MessageBox.Show("Mouse Clicked");
            base.WndProc(ref m);

But I only recive the "Mouse Clicked" MessageBox when my application
has focus.

I also tried setting a hotkey and listening for the "WM_HOTKEY" but
"RegisterHotKey(this.Handle, 101, 0, (uint)Keys.LButton)" doesn't seem
to caputre the left clicks eventhough it says it successfully
registered the hotkey.

I also tried with "uint VK_LBUTTON = 0x01" &
RegisterHotKey(this.Handle, 101, 0, VK_LBUTTON) but doesn't work.
NOTE: The hotkey method works if I change the "(uint)Keys.LButton" to
an actual keyboard key "IE (uint)Keys.F1".

Any help would be great ;)


Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc