Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MouseHookStruct in VC++ 4.0 framework

Posted on 1997-07-21
2
Medium Priority
?
607 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 90 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared 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…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

824 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