Solved

MouseHookStruct in VC++ 4.0 framework

Posted on 1997-07-21
2
587 Views
Last Modified: 2013-12-03
I need to get hold of the extra information dwExtraInfo in the current valid MOUSEHOOKSTRUCT in the Visual C++ application framework.  It's for a 3D input device (FreeD) and the extra info is the Z parameter.  How do i do this?  Unfortunately the examples as always have been provided for non-Visual C++ .  Thanks for any help.
0
Comment
Question by:kingpie
2 Comments
 
LVL 1

Accepted Solution

by:
belov earned 30 total points
Comment Utility
If you just need to obtain recent MOUSEHOOKSTRUCT
dwExtraInfo value, there are two ways. First is
to install mouse hook procedure.
Write LRESULT CALLBACK MouseProc(int nCode,
WPARAM wParam,  LPARAM lParam )
function, and you will get pointer to MOUSEHOOKSTRUCT
in lParam. This procedure must behave like other hook
procedures, i.e. return CallNextHookEx if nCode < 0.
You must not perform complex actions in hook procedure,
so you may want to save dwExtraField for later use.
This function must be registered as active hook
calling SetWindowHookEx with WH_MOUSE hook type.
And you'd better place hook code in DLL library,
if you want to install it system-wide.
Don't forget to UnhookWindowsHookEx
when terminating your programm.

The second is simplier but may not work.
You may call GetMessageExtraInfo() function,
which returns extra information supplied
with the message. In normal conditions
it will be the same as dwExtraInfo field of
MOUSEHOOKSTRUCT, so you don't need
hook at all, and call it on mouse notification
messages.

0
 

Author Comment

by:kingpie
Comment Utility
Thank you, the second option GetMessageExtraInfo works perfectly.

0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now