Solved

Toggling Xmouse on Windows NT 4.0

Posted on 1998-05-11
7
517 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
computer science syllabus 3 102
Arduino EDI - Programming language 3 115
Add values of each row in an array 3 70
max float value 3 59
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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++.

733 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