Solved

Toggling Xmouse on Windows NT 4.0

Posted on 1998-05-11
7
500 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
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 concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

757 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now