How to get info from control panel file(*.cpl)

  • Thread starter Thread starter yxq
  • Start date Start date
Y

yxq

Hello
I want to retrive the name & Description from a Control Panel Applet(or
*.cpl file),
how to do?

Thanks
 
yxq said:
Hello
I want to retrive the name & Description from a Control Panel
Applet(or
*.cpl file),
how to do?

Thanks

Untested:

System.Diagnostics.FileVersionInfo.GetVersionInfo
 
Hello
Thank your answer, but it cannot get the right description!
You can view the description of *.cpl using notepad.exe.
 
yxq said:
Hello
Thank your answer, but it cannot get the right description!
You can view the description of *.cpl using notepad.exe.

I opened desk.cpl in notepad, but I don't know which description you mean.

When you open the file properties in the explorer, is the description
shown anywhere? Which one are you referring to?
 
* "Armin Zingler said:
I opened desk.cpl in notepad, but I don't know which description you mean.

When you open the file properties in the explorer, is the description
shown anywhere? Which one are you referring to?

If you are using Windows XP, open the list of all available control
panels and hover one of them with the mouse (the icon). A description
will be displayed as a tooltip.
 
Herfried K. Wagner said:
If you are using Windows XP, open the list of all available
control panels and hover one of them with the mouse (the icon). A
description will be displayed as a tooltip.

Ah, ok. You can open the file in the IDE and view the (unmanaged) resources.
There's a string table (value=42) containing the text. I've no clue how
reliable it is to extract this string.
 
* "Armin Zingler said:
Ah, ok. You can open the file in the IDE and view the (unmanaged) resources.
There's a string table (value=42) containing the text. I've no clue how
reliable it is to extract this string.

Sometimes the string has ID 2, sometimes 4, sometime 5. I didn't find
any information on how to add this text in the MSDN library (maybe I
missed something).
 
Hi
I have tested it, but it cannot get the Description in *.cpl file!
Please view Description using notepad.exe.
 
yxq said:
Hi
I have tested it, but it cannot get the Description in *.cpl
file!
Please view Description using notepad.exe.

Did you read the other posts in this thread?

I don't have a solution. It seems that the description is stored as a win32
resource but I don't have a reliable way to get it. I also didn't find a
documentation to get the description - probably because there is none.
 
Each *.cpl file exports a function called CplApplet that you can call with
the appropriate message constant to retrieve information about the applet
(including the description). The MSDN library has a good article on this.

http://msdn.microsoft.com/library/d...shell/programmersguide/shell_adv/conpanel.asp


Unfortunately, if you want to get the information from an arbitrary applet
you can't use a standard PInvoke call since you don't know the name or path
of the applet until runtime. A good method to use in these cases is to use
System.Reflection.Emit to create a dynamic PInvoke call. Check out Matthias
Sjogren's excellent website for an example.

http://www.msjogren.net/dotnet/eng/samples/dotnet_dynpinvoke.asp
 
Back
Top