Solved

Toggling Xmouse on Windows NT 4.0

Posted on 1998-05-11
7
509 Views
Last Modified: 2008-02-01
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.
0
Comment
Question by:jamesbrown
  • 4
  • 3
7 Comments
 
LVL 1

Expert Comment

by:fwilkinson
ID: 1175846
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
 
LVL 1

Expert Comment

by:fwilkinson
ID: 1175847
I forgot to mention this before, but TweakUI uses both the functions I listed.
0
 

Author Comment

by:jamesbrown
ID: 1175848
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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 1

Expert Comment

by:fwilkinson
ID: 1175849
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
 

Author Comment

by:jamesbrown
ID: 1175850
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
 
LVL 1

Accepted Solution

by:
fwilkinson earned 260 total points
ID: 1175851
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
 

Author Comment

by:jamesbrown
ID: 1175852
Thank you.  I looked and loked and did not find.

JB
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

770 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