Click to See Complete Forum and Search --> : rundll32 utility


shadowx360
October 24th, 2008, 05:51 PM
Hey, I wanted to use the rundll32 utility to switch the mouse buttons at startup. Yeah, I know you can do it from the control panel, but this is part of a project for one of my classes. So, I tried this line:

system("rundll32 user,swapmousebutton");

However, it just returns the line: Error loading Mouse. The specified module cannot be found.

Crazy, isn't it? I tried a few other rundll32 functions, such as:

rundll32 keyboard,disable
rundll32 mouse,disable
rundll32 user,exitwindows
rundll32 user,swapmousebutton
rundll32 user,SetDoubleClickTime

But all returned an Error about can't find module. I also tried to paste it into a batch file and see if it was my programming, but it wouldn't work in batch files error, with the same error. help?

TheCPUWizard
October 24th, 2008, 06:04 PM
What OS are you running???

shadowx360
October 24th, 2008, 06:20 PM
What OS are you running???

Windows XP SP3 x86 Media Center

You can try it in a batch file and you can see if it works for you.

kirants
October 24th, 2008, 06:48 PM
How did you arrive at the following command lines? Is there a documentation anywhere you can point to?

rundll32 keyboard,disable
rundll32 mouse,disable
rundll32 user,exitwindows
rundll32 user,swapmousebutton
rundll32 user,SetDoubleClickTime

kirants
October 24th, 2008, 06:50 PM
Also , have you explored SystemParametersInfo API ?

shadowx360
October 24th, 2008, 07:55 PM
Also , have you explored SystemParametersInfo API ?

Hm, let me explore it a bit, this might be an alternative to rundll32. I also would appreciate any other suggestions from all viewers regarding rundll32. Thank you.

kirants
October 24th, 2008, 07:57 PM
I also would appreciate any other suggestions from all viewers regarding rundll32. Thank you.
You still haven't answered my first question.

shadowx360
October 24th, 2008, 09:07 PM
You still haven't answered my first question.

I'm so sorry about that, I didn't see it. Well, after

system("rundll32 user,swapmousebutton");

Didn't work, my friend told my to try out some other functions from rundll32, and he gave me a few examples to try out.

I appreciate you patience and help. Thanks in advance.

TheCPUWizard
October 24th, 2008, 09:09 PM
I'm so sorry about that, I didn't see it. Well, after

system("rundll32 user,swapmousebutton");

Didn't work, my friend told my to try out some other functions from rundll32, and he gave me a few examples to try out.

I appreciate you patience and help. Thanks in advance.


So where is the documentation that you have been asked for....

(If your friend suggested trying to jump of a bridge, would you do it???)

kirants
October 24th, 2008, 10:57 PM
Here is one article although it doesn't talk about modifying but about being able to launch the control panel applets themselves. If there is any other documentation , I'd be curious to see it. As far as I know, the way to do what the control panel ( the system supplied ones ) is to use SystemParametersInfo.

Running Windows XP Control Panel Applets from Visual Basic.NET 2005 (http://www.codeguru.com/vb/gen/vb_system/win32/article.php/c13963/)

shadowx360
October 25th, 2008, 10:56 AM
Here is one article although it doesn't talk about modifying but about being able to launch the control panel applets themselves. If there is any other documentation , I'd be curious to see it. As far as I know, the way to do what the control panel ( the system supplied ones ) is to use SystemParametersInfo.

Running Windows XP Control Panel Applets from Visual Basic.NET 2005 (http://www.codeguru.com/vb/gen/vb_system/win32/article.php/c13963/)


Hey, thanx for that link. Well, anyways, I found this article: Using Rundll32.exe in Windows XP (http://vlaurie.com/computers2/Articles/rundll32.htm/)

Its very interesting, and the first line that I tried worked for me perfectly:

RUNDLL32.EXE USER32.DLL,SwapMouseButton

I also found out the hard way that this command isn't a toggle. My problem was that I forgot to include the ".exe" after rundll32, since rundll32.exe isn't in the same directory as my program, it can't be used as a command line switch unless I specify the .exe, which is in the parent %systemroot%\system32 folder. Thanks for all the help you guys have given me. I really appreciate it.

kirants
October 25th, 2008, 11:47 AM
That is an interesting read. Thanks for sharing the link here , who knows it might help someone else in future.

What is interesting is I don't understand what SwapMouseButton does. It says it is not a toggle, then what is it ? What happens if you run the same twice ?

shadowx360
October 25th, 2008, 05:36 PM
That is an interesting read. Thanks for sharing the link here , who knows it might help someone else in future.

What is interesting is I don't understand what SwapMouseButton does. It says it is not a toggle, then what is it ? What happens if you run the same twice ?


Oh, it just switches the primary and secondary buttons on your mouse, like say, if you were left handed and wanted to use my mouse. It doesn't toggle, so running it twice produces no effect, as the swap remains in place, and you have to use the control panel or registry to change it back. I found that out the hard way. :-)

TheCPUWizard
October 26th, 2008, 09:22 AM
Oh, it just switches the primary and secondary buttons on your mouse, like say, if you were left handed and wanted to use my mouse. It doesn't toggle, so running it twice produces no effect, as the swap remains in place, and you have to use the control panel or registry to change it back. I found that out the hard way. :-)

If you bothered to READ THE DOCUMENTATION (http://msdn.microsoft.com/en-us/library/ms646264(VS.85).aspx) you would know that it takes a parameter which indicates if you are going to swap or restore!!!!!