Solved

MouseHookStruct in VC++ 4.0 framework

Posted on 1997-07-21
2
589 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
ID: 1401524
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
ID: 1401525
Thank you, the second option GetMessageExtraInfo works perfectly.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

896 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

15 Experts available now in Live!

Get 1:1 Help Now