Toggling Xmouse on Windows NT 4.0

I am trying activate/deactivate XMouse on a Windows NT machine (similar to the XMouse check box in TweakUI).  I have found the registry key ("HKEY_CURRENT_USER\Control Panel\Mouse\ActiveWindowTracking") and I can change the value there of.  

But, I cannot force the necessary refresh to activate/deactivate XMouse.  But, after logging out and logging back in, XMouse is set as expected.

So, is there an API call to force the refresh?  (Note: I have tried :
::SendMessage (HWND_BROADCAST, WM_SETTINGCHANGE, NULL, NULL);
which does not seem to work.

Do I have to "restart" the mouse device?  If so, how?

Any help would be greatly appreciated.

Cheers,JB.
jamesbrownAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

fwilkinsonCommented:
SystemParametersInfo() claims to do this for NT 5.0, but you might want to try it just in case.

SHChangeNotify() might be a way of kicking the shell into noticing the change you made to the registry, without having to reboot.  Have you read the documentation for this function?


0
fwilkinsonCommented:
I forgot to mention this before, but TweakUI uses both the functions I listed.
0
jamesbrownAuthor Commented:
I have looked at the parameters that are available for use in SHChangeNotify() and SystemParametersInfo() and none of them even hint at anything close to performing what I need done.  If you know of an undocumented parameter, please let me know.

JB
0
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

fwilkinsonCommented:
What version of the documentation are you reading?

I just spent some time hacking about, and I have the answer you want.  It took me a couple of hours though, so do you think you could raise the value of this question?  it would make me feel better about spending my time this way.


0
jamesbrownAuthor Commented:
I took a look at the documentation - not exactly sure what version.  I did however have a look through the MSDN site and found that in NT 5 SystemParametersInfo() has SPI_GETACTIVEWINDOWTRACKING and SPI_SETACTIVEWINDOWTRACKING.  But I need this for NT 4.  I looked all over for the #define's for these but could not find them.  I hope your solution works for NT 4.

JB
0
fwilkinsonCommented:
I did some experiments with TweakUI, which lead me to belive it was using a documented API function to change the xmouse status.  Upon closer examination, I discovered that it was passing undocumented arguments to SystemParametersInfo().  I tried using a few of these arguments myself, and eventually found the values you need, which are not defined in my copy of winuser.h:

#define SPI_GETACTIVEWINDOWTRACKING 108
#define SPI_SETACTIVEWINDOWTRACKING 109

I wrote a command line app that demonstrates the usage of these parameters, which is attached below.

(Thanks for raising the point value.)

#include <iostream>
#include <windows.h>
using namespace std;

// SystemParametersInfo() arguments that aren't defined
// in the Windows NT 4.0 SDK header files:
#ifndef SPI_GETACTIVEWINDOWTRACKING
#define SPI_GETACTIVEWINDOWTRACKING 108
#define SPI_SETACTIVEWINDOWTRACKING 109
#endif

void main()
   {
   // show previous xmouse state:
   BOOL xmouse = FALSE;
   if (!SystemParametersInfo( SPI_GETACTIVEWINDOWTRACKING, 0, &xmouse, 0))
      {
      cout << "SystemParametersInfo() fialed." << endl;
      return;
      }
   cout << "xmouse was " << (xmouse ? "" : "not ") << "previously set." << endl;

   // change xmouse state:
   xmouse = !xmouse;
   if (!SystemParametersInfo( SPI_SETACTIVEWINDOWTRACKING, 0, (PVOID)xmouse, 0))
      {
      cout << "SystemParametersInfo() fialed." << endl;
      return;
      }
   cout << "xmouse state has been changed." << endl;
   }
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jamesbrownAuthor Commented:
Thank you.  I looked and loked and did not find.

JB
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.