tags:

views:

81

answers:

5

I think it's possible to somehow hook with the windows environment (specifically explorer.exe) and trigger specific things, for example launching control panel and using it as if I had mouse (meaning I'm clicking the interface from the code).

Basically what I'm trying to do is automate some redundant tasks I do often, just I don't know how it's done, or even how it's called. Anyone can point me in right direction?

Thanks!

+1  A: 

Windows Explorer has a COM object model that you can call from both C# and C++. (Most of the examples on MSDN are in Javascript or VBScript, which I guess aren't your languages of choice, but they demonstrate that the API is straightforward to call.)

Tim Robinson
+1  A: 

AutoHotKey is a scripting environment specifically designed for this sort of task

Colin Pickard
The catch is that I'd like to do it on my own, otherwise this would be on Yahoo! Answers I suppose. I've used that and that's something similar I'm trying to recreate.
Johnny
@Johnny: so look at their documentation to see what they call it, and look at their source to see how they do it…
Gilles
I'm just about to do that now, had to go away for couple hours though.This is just for practice purposes, I thought there just might be some technique for that, a practical way instead of workaround.
Johnny
+3  A: 

Forget about "automated clicking". GUI tools are just front-ends to control the system. You can control the system like they do, it will be much easier.

  1. Huge possibilities can give you Microsoft Management Console. Each "snap-in" can be accessed via COM model. Some of them have GUI front-ends, find and fire "*.msc" files (somewhere in Windows directory) to try them.

  2. There is many command line tools i.e. "net" command has huge abilities related to networking.

  3. PowerShell may be a better choice instead of C# or C++, it's designed for task automation. You can easily use COM, .NET, MMC ...

adf88
I was just looking for ideas how to do some interaction with system, this answer is the most comprehensive one. Although I'd add that SendMessage() answer from below may come in handy for anyone who approaches this question.
Johnny
+1  A: 

If you want mostly to launch control panel you can do using RunDll32 interface existing in the most control panel applets. See http://www.osattack.com/windows-7/huge-list-of-windows-7-shell-commands/ , http://support.microsoft.com/kb/167012 or http://www.winvistaclub.com/t57.html for example. For the corresponding API see http://support.microsoft.com/kb/164787.

Another option is usage of control.exe (see http://msdn.microsoft.com/en-us/library/cc144191.aspx and http://vlaurie.com/computers2/Articles/control.htm).

If you google more you will find much more examples which you can to automate a lot of things without using of some general ways to automate GUI.

Oleg
+1  A: 

At more or less the lowest level within Win32, you can use the SendMessage() API to send raw click messages to windows of interest. This will rely on a lot of intrusive knowledge about the apps you intend to drive. However, you could easily implement a "click recorder" that could replay click sequences captured from user interaction.

Drew Hall