Similar Topics...
|
Installing Fonts in C# The following C# code will install a font on a 32 bit machine. int Ret; int Res; string FontPath; const int WM_FONTCHANGE = 0x001D; const int HWND_BROADCAST = 0xffff; FontPath = WinFontDir + "\" + FontFileName; Ret = FontInstall.AddFontResource(FontPath); Res = FontInstall.SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0); Ret = FontInstall.WriteProfileString("fonts", FontName + " (TrueType)", FontFileName); With of course, the API functions: [DllImport("kernel32.dll", SetLastError=true)] static extern int WriteProfileString( string lpszSection, string lpszKeyName, string lpszString) ; [DllImport("user32.dll")] public static extern int SendMessage(int hWnd, // handle to destination window uint Msg, // message int wParam, // first message parameter int lParam // second message parameter ); [DllImport("gdi32")] public static extern int AddFontResource(string lpFileName);
Created By: amos 3/20/2006 12:13:00 AM Updated: 3/12/2023 5:11:45 AM
|
|
|
|
|
|