How to Run charmap.exe with a chosen font?
-
I'd like to have charmap.exe open with the same font I'm using in my application's main window. But I've had no success passing arguments to it. I had assumed that:
Process.Start("charmap.exe", "Arial")
would get it done. But this has no effect. Suggestions?
XAlan Burkhart
-
I'd like to have charmap.exe open with the same font I'm using in my application's main window. But I've had no success passing arguments to it. I had assumed that:
Process.Start("charmap.exe", "Arial")
would get it done. But this has no effect. Suggestions?
XAlan Burkhart
That's because CharMap doesn't take any command line arguments. AFAIK, the only way to open it at a specific font would be to launch it, make sure the window has the focus and then use SendKeys to send the font name, essentially typing it into the drop down list in CharMap.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
That's because CharMap doesn't take any command line arguments. AFAIK, the only way to open it at a specific font would be to launch it, make sure the window has the focus and then use SendKeys to send the font name, essentially typing it into the drop down list in CharMap.
A guide to posting questions on CodeProject[^]
Dave KreskowiakI had considered this but was wanting to send arguments instead. But
SendKeys
works perfectly. Thanks much for the info.XAlan Burkhart
-
I had considered this but was wanting to send arguments instead. But
SendKeys
works perfectly. Thanks much for the info.XAlan Burkhart
Arguments only work when the target app is expecting them, and only if you use the switches it expects.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
I'd like to have charmap.exe open with the same font I'm using in my application's main window. But I've had no success passing arguments to it. I had assumed that:
Process.Start("charmap.exe", "Arial")
would get it done. But this has no effect. Suggestions?
XAlan Burkhart
You can do this via the registry.
Dim CharMap_Key As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\CharMap", writable:=True)
Dim currentfont As String = CStr(CharMap_Key.GetValue("Font", defaultValue:=""))
CharMap_Key.SetValue("Font", "Arial")
Dim proc As Process = Process.Start(Environment.SystemDirectory & "\charmap.exe") -
I'd like to have charmap.exe open with the same font I'm using in my application's main window. But I've had no success passing arguments to it. I had assumed that:
Process.Start("charmap.exe", "Arial")
would get it done. But this has no effect. Suggestions?
XAlan Burkhart
In my case, charmap.exe already opens with "Arial" as the selected value - Of course, if you have a different font in your app you'll need to go the SendKeys-Way.
:bob: