Monday, March 28, 2011

Display Windows character map applet?

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?

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

    try
    {
        Process.Start("charmap.exe");
    }
    catch (Win32Exception e)
    {
        // show message
    }
    
  • Process.Start is what I was looking for. Thanks, Marc.

0 comments:

Post a Comment