hooking windows messages?

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Post Reply
ddean
Posts: 3
Joined: Thu Jul 03, 2014 1:53 pm

hooking windows messages?

Post by ddean »

We have two editions of our product -- one entirely in C++, and a version that has a C# WPF interface which passes the HWND to C++ code for rendering.

I integrated 3DxWare into the C++ code without difficulty by adding SiGetEventWinInit/SiGetEvent calls to WindowProc. It works beautifully.

However, I would like to put the code in one place, and ideally not even touch the C# code -- so I was thinking I'd use SetWindowsHookEx() to watch for the relevant messages.

If I use WH_CALLWNDPROC, I don't get any messages at all from 3DxWare.
If I use WH_GETMESSAGE, it's only triggered when the window happens to be getting messages -- so if I'm moving the SpaceNavigator alone, I get nasty intermittent gaps; if I move the mouse simultaneously to generate messages it's smoother.

Am I thinking along the wrong lines here? Should I just bite the bullet and add at least some minimal C# code in the WndProc instead of messing with a hook?

Thanks!
ddean
Posts: 3
Joined: Thu Jul 03, 2014 1:53 pm

Re: hooking windows messages?

Post by ddean »

Nevermind, I decided to just have the C# WndProc call my C++ code.
mikeda_pro
Posts: 5
Joined: Mon Sep 15, 2014 11:39 pm

Re: hooking windows messages?

Post by mikeda_pro »

see :

SiGrabDevice(devHdl, SPW_TRUE); /* PREVENTS OTHER APPLICATIONS FROM RECEIVING 3D CONNEXION DATA !!! */ // helps to bind the device to the application (window,...) exclusively

in :

viewtopic.php?f=19&t=8967&p=36169#p36169

br
Post Reply