How would a guy at Microsoft...

N

nano2k

....open Windows's Calc?
I want to integrate a shortcut to Windows Calc in my application.
Ok, it seems quite str8 forward:
1. put a button / link label, whatever on a form
2. grab Calc's icon from system32\calc.exe and attach it to the
button, etc, if needed.
3. Call Process.Start("calc.exe") when the button is clicked.

Anyway, I wonder how a guy at MS would:
1. Get Calc's icon. That is, is there another way of "stealing" the
icon?
2. Start Calc.
 
N

Nicholas Paldino [.NET/C# MVP]

In order to get the icon of any file, you should call the SHGetFileInfo
API function through the P/Invoke layer. It is the only function that will
take into account things like shell namespace handlers, registry entries,
and the like to give you the proper icon for any file (or any ^type^ of
file, for that matter).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top