Solved

MouseHookStruct in VC++ 4.0 framework

Posted on 1997-07-21
2
590 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
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…
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…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

809 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