Question

What's the best way to display Windows' character map applet from my .NET (C#) application? I know it's an optional component, so I want to display a message to the user if they don't have it installed.

I've tried using

ShellExecute( 0, "OPEN", "charmap.exe", "", "", 0 );

but all that happens is my app loses focus and character map doesn't open. As a test, I tried "calc.exe", and it works, as does using "charmap.exe" from the Run dialog. What am I missing?

Was it helpful?

Solution

How about Process.Start("charmap.exe"), catching the exception if it isn't installed?

try
{
    Process.Start("charmap.exe");
}
catch (Win32Exception e)
{
    // show message
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top