473,749 Members | 2,626 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Installing a TT-Font

Hi

How would I go about installing a font file on WinXP?

I have tried this and it won't get installed properly,

private void installFont()
{
File.Copy( Application.Sta rtupPath+"\\Luc on1.ttf",
this.fontDir+"\ \Lucon1.ttf", true );
key.SetValue( "Lucida Console ANSI
TrueType)", "Lucon1.ttf ");
SendMessage((Sy stem.IntPtr)HWN D_BROADCAST,
WM_FONTCHANGE, 0, 0);
}
Nov 16 '05 #1
4 6926
Johan,

Does your app include a Setup Project? Because if you build a setup project
for your app, you can add fonts to it and when the user installs it the
fonts will be automatically installed, and removed upon un-install.

JIM
"Johan" <he***@hotmail. com> wrote in message
news:5e******** *************** *****@phx.gbl.. .
Hi

How would I go about installing a font file on WinXP?

I have tried this and it won't get installed properly,

private void installFont()
{
File.Copy( Application.Sta rtupPath+"\\Luc on1.ttf",
this.fontDir+"\ \Lucon1.ttf", true );
key.SetValue( "Lucida Console ANSI
TrueType)", "Lucon1.ttf ");
SendMessage((Sy stem.IntPtr)HWN D_BROADCAST,
WM_FONTCHANGE, 0, 0);
}

Nov 16 '05 #2
Yes I know I could go that way, but I was kind of hoping to just end up with
one exe-file for the application without the need for installation...

/Johan

"James" <no****@hyperco n.net> wrote in message
news:%2******** *******@TK2MSFT NGP15.phx.gbl.. .
Johan,

Does your app include a Setup Project? Because if you build a setup
project for your app, you can add fonts to it and when the user installs
it the fonts will be automatically installed, and removed upon un-install.

JIM
"Johan" <he***@hotmail. com> wrote in message
news:5e******** *************** *****@phx.gbl.. .
Hi

How would I go about installing a font file on WinXP?

I have tried this and it won't get installed properly,

private void installFont()
{
File.Copy( Application.Sta rtupPath+"\\Luc on1.ttf",
this.fontDir+"\ \Lucon1.ttf", true );
key.SetValue( "Lucida Console ANSI
TrueType)", "Lucon1.ttf ");
SendMessage((Sy stem.IntPtr)HWN D_BROADCAST,
WM_FONTCHANGE, 0, 0);
}


Nov 16 '05 #3
Hi,

You should rather use the GDI Function AddFontResource by P-Invoke,
shouldn't you? I was searching for sample code demonstrating how to load
the font out of a ttf file but all i found were some functions, one of
them is AddFontResource .

This could be your signature:

[DllImport("gdi3 2")]
static extern int AddFontResource (string lpszFilename);
// returns the number of fonts installed
This could be your Add font function:

public static bool AddFont(string filename)
{
if (System.IO.File .Exists(filenam e))
{
// returns true if (>=1) font is installed
return (AddFontResourc e(filename) != 0);
}
return false;
}

I do not know whether it does the right thing for you, but you may givbe
it a try if it does

Greets,

AS
Nov 16 '05 #4
Oh no, it doesn't work...
Perhaps system font table is something different than system fonts or it
installs the font for the calling app only.

Andreas Schöneck schrieb:
Hi,

You should rather use the GDI Function AddFontResource by P-Invoke,
shouldn't you? I was searching for sample code demonstrating how to load
the font out of a ttf file but all i found were some functions, one of
them is AddFontResource .

This could be your signature:

[DllImport("gdi3 2")]
static extern int AddFontResource (string lpszFilename);
// returns the number of fonts installed
This could be your Add font function:

public static bool AddFont(string filename)
{
if (System.IO.File .Exists(filenam e))
{
// returns true if (>=1) font is installed
return (AddFontResourc e(filename) != 0);
}
return false;
}

I do not know whether it does the right thing for you, but you may givbe
it a try if it does

Greets,

AS

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4926
by: Jean-Christian Imbeault | last post by:
I have a user account on a RH Linux machine but no root access. I succesfully installed apache 1.3 under my /home/ account but can't get PHP to install properly. I have done the following steps: #1 compiled and installed apache using --prefix=/home/imbeauje/apache. Tested that it works.
1
2402
by: SAP BASIS Consultant | last post by:
Hello, I am installing SAP R/3 on Win2000/SQL Server. There is a CD with the SQL Server RDBMS, as well as another one with SP 3A (Both are from SAP). According to the SAP installation manual, after installing those I have to install 'QMF' for SQL Server. It indicates to check Microsoft's documentation on installing QMF on SQL Server. I searched Microsoft's Website, but I did not find any information on QMF. Any ideas on the procedure...
0
2816
by: Chris Halcrow | last post by:
Hi I've spent ALL DAY trying to re-install SQL Server 2000 on Windows XP. I continually get the error 'cannot configure server' just at the end of the installation. I've tried the following: - Removing SQL server from 'Program Files' folder following an unsuccessful attempt to re-install, and entirely removing the registry entry 'HKEY_CURRENT_USER > SOFTWARE > Microsoft > MSSQLServer', as well as the corresponding entry under...
5
2721
by: Gerald Hernandez | last post by:
One of my development PC's died, and I need to have legacy VS and VS.Net installed at the same time. On the now dead PC, I had VS6 installed prior to installing VS.Net. This worked just fine. On my working PC, I already have VS.Net installed, but not VS6. My question, will installing the older VS6 with VS.Net already installed give me problems with VS.Net. Or should I first remove the VS.Net, install VS6, then re-install VS.Net? Gerald
0
2632
by: Steve | last post by:
I'm posting this message here, so that someone googling here will be able to find it. I was having problems installing cx_Oracle on Solaris. The build would fail with a message: > ld: fatal: file /apps/oracle/prod/9.2/lib/libclntsh.so: wrong ELF class: ELFCLASS64 I found the solution on Grig Gheorghiu's blog. Grig had similar problems when installing on UNIX, specifically AIX. You can find his
3
4123
by: jaggi | last post by:
Hi all, I downloaded DB2 enterprise edition from partnerworld on ibm.com and unzipped and untarred it and copied it to CD and tried installing on AIX using SMIT. I am getting errors while installing DB2. they seems like related to java or dependent on java. Is there anyone who has faced some problem installing DB2? Do i have to install Java from expansion pack or bonus pack before installing DB2 regards,
3
1612
by: mariantrygg | last post by:
Hi I have an app that uses the a2K run-time. I have just discovered that installing this app breaks an access2003 installation causing the user to have to repair the installation using the original installation CD. I would prefer not to be seen to be 'breaking' customer's computers, (thanks Microsoft!!!) Does anyone know how to avoid this happening? I am installing the run-time into a separate folder under my program folder...
13
8380
by: bjhartin | last post by:
All, I was working at a client's site when I installed Visual Basic 6 on a machine at their request. Existing applications on this machine had specified version 4.0 of the Jet OLEDB provider in a data source string in their config files. After installing VB 6, they stopped working, producing the error "3220: The supplied provider is different from the one already in use. Changing their configuration files to specify version 3.5.1...
7
2918
by: Adam | last post by:
Im trying to add an httphandler for all *.sgf file extensions. I have developed the handler, 1. installed it into the gac 2. added it to the machine.config: <httpHandlers> <add verb="*" path="*.sgf" type="CustomExtensionHandler, Extenders.CustomExtensionHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d831d925597c1031" validate="True"/> </httpHandlers>
11
5780
by: tshad | last post by:
I have a small Windows Service program that just has a timer on it and it built fine. I try to install it using InstallUtil and I get the following message: System.ComponentModel.Win32Exception: The account name is invalid or does not exist, or the password is invalid for the account name specified I am in the same folder my program is in (MyService.exe). I assume it has to do with Logon Credentials.
0
8997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8833
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9389
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8257
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6079
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4709
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4881
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.