Sign in to follow this  
Followers 0
LarsJ

The Control Panel

6 posts in this topic

#1 ·  Posted (edited)

Posted Image

The files and folders of the Control Panel can be enumerated with the IShellFolder and IEnumIDList interfaces.

In this example (run cpGui.au3) the files and folders are shown in a GUI with a TreeView and a ListView.

Double click an item (or press Enter) in the ListView to execute. Right click to show the context menu.

Executing a program and showing the context menu are implemented with the IContextMenu interface.

If you are running a 64 bit OS you must run this script (cpGui.au3) as a 64 bit program.

Exceptions

The Control Panel isn't as easy to enumerate as a normal file system folder. Especially on Vista and 7. Some containers or pages appears as folders but must be treated as files. Some items appears as both files and folders. And there can be some "empty" items without a display name that have to be removed. You have to do some exceptions to make everything look properly.

cpPrint.au3 is a script to print the files and folders of the Control Panel in the Scite console. By comparing the output from the script with the real Control Panel you can figure out the exceptions.

If you are running a 64 bit OS you must run this script (cpPrint.au3) as a 64 bit program.

Here are some of the exceptions on my Windows 7 64 bit PC.

Containers or pages that appears as folders but must be treated as files:

Control Panel = ::{26EE0668-A00A-44D7-9371-BEB064C98683}
--[\System and Security] = ::{26EE0668-A00A-44D7-9371-BEB064C98683}\5
----[\Power Options] = ::{26EE0668-A00A-44D7-9371-BEB064C98683}\5\::{025A5937-A6BE-4686-A844-36FE4BEC8B6D}
----[\Windows Update] = ::{26EE0668-A00A-44D7-9371-BEB064C98683}\5\::{36EEF7DB-88AD-4E81-AD49-0E313F0C35F8}
----[\Windows Firewall] = ::{26EE0668-A00A-44D7-9371-BEB064C98683}\5\::{4026492F-2F69-46B8-B9BF-5654FC07E423}

Empty item:

Control Panel = ::{26EE0668-A00A-44D7-9371-BEB064C98683}
--[\System and Security] = ::{26EE0668-A00A-44D7-9371-BEB064C98683}\5
----[] = ::{26EE0668-A00A-44D7-9371-BEB064C98683}\5\::{25C64847-B900-48AD-A164-1B4F9B774650}

The empty items (no display name, only parsing name) are probably caused by failed program installations or updates.

And some exceptions on my Windows XP SP3.

Items that appears as both files and folders:

Control Panel = ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}
--[\Network Connections] = ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\::{7007ACC7-3202-11D1-AAD2-00805FC1270E}
----[\Local Area Connection] = {BA126ADB-2166-11D1-B1D0-00805FC1270E}
----[\Internet Connection] = {BA126AE2-2166-11D1-B1D0-00805FC1270E}
----[Local Area Connection] = {BA126ADB-2166-11D1-B1D0-00805FC1270E}
----[Internet Connection] = {BA126AE2-2166-11D1-B1D0-00805FC1270E}

These exceptions are handled in the functions EnumTreeViewObjects() and EnumListViewObjects() in cpFuncs.au3.

Remark that the Fonts folder is skipped in cpPrint.au3.

Zipfile

The zipfile below contains a number of files:

  • cpGui.au3 - the GUI, run this file
  • cpConsts.au3 - constants and globals
  • cpFuncs.au3 - functions for the GUI
  • ContextMenu.au3 - context menu
  • cpPrint.au3 - print files and folders
  • Common.au3 - common functions
  • Functions.au3 - utilities
  • GetIcon.au3 - icon functions
  • HourglassOff.au3 - turn hourglass off
  • res\WSP.dll - NM_RETURN notifications in the ListView
If the script fails for some reason and you are left with an hourglass cursor, then run HourglassOff.au3 to get the normal cursor back.

For WSP.dll by Yashied see http://www.autoitscript.com/forum/index.php?showtopic=83621 post #16.

You need APIConstants.au3 and WinAPIEx.au3 v3.8 by Yashied.

Testet on Windows XP SP3 and Windows 7 64 bit.

ControlPanel.7z

Edited by LarsJ
1 person likes this

Share this post


Link to post
Share on other sites



You have so many redeclared constants and some without your script doesn't work you left it out.

Posted Image


When the words fail... music speaks

Share this post


Link to post
Share on other sites

Andreik, This error is because of an undeclared $S_OK variable. $S_OK is declared in APIConstants.au3 v3.8 as you need to run the script.

Lars

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Share this post


Link to post
Share on other sites

Yashied, You are absolutely right. Thank you very much.

ptrex, If this is for the OP then thank you. The splitterbar was the easy part.

Lars.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0