[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Toggling Xmouse on Windows NT 4.0

Posted on 1998-05-11
7
Medium Priority
?
535 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
Industry Leaders: 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 520 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

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

649 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