By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,565 Members | 1,735 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,565 IT Pros & Developers. It's quick & easy.

SendMessage, fonts

P: n/a
2G
Hi everybody

I think i'm doing something wrong . :)

When I install a new font, all my programs (like photoshop) that are running
don't respond anymore for like 2 min, after that I can use the font whitout
restarting the applications but I can not delete the font untill i reboot my
pc (i tried killing all processes but that didn't work).

If anyone would take a look , I do the following :

[DllImport("user32.dll", CharSet=CharSet.Auto)] static extern IntPtr
SendMessage(IntPtr hwnd, int msg, int wParam, int lParam);

private const int HWND_BROADCAST = 0xffff;

private const int WM_FONTCHANGE = 0x001D;

private void cmdInstall_Click(object sender, System.EventArgs e){

clsFontFamily f = (clsFontFamily)cboFonts.SelectedItem;

string n = f.Path.Substring(f.Path.LastIndexOf("\\")+1);

File.Copy(f.Path, iPath + "\\" + n, false);

SendMessage((System.IntPtr)HWND_BROADCAST, WM_FONTCHANGE, 0, 0);

int i = AddFontResource(iPath + "\\" + n);

}

Thx in advance.


Nov 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi 2G,
Probably you should notify after adding the font to the fornt resource pool.
Have you tried to change places of SendMessage and AddFontResource calls.

--
HTH
B\rgds
100
"2G" <2g@pandora.be> wrote in message
news:5k******************@phobos.telenet-ops.be...
Hi everybody

I think i'm doing something wrong . :)

When I install a new font, all my programs (like photoshop) that are running don't respond anymore for like 2 min, after that I can use the font whitout restarting the applications but I can not delete the font untill i reboot my pc (i tried killing all processes but that didn't work).

If anyone would take a look , I do the following :

[DllImport("user32.dll", CharSet=CharSet.Auto)] static extern IntPtr
SendMessage(IntPtr hwnd, int msg, int wParam, int lParam);

private const int HWND_BROADCAST = 0xffff;

private const int WM_FONTCHANGE = 0x001D;

private void cmdInstall_Click(object sender, System.EventArgs e){

clsFontFamily f = (clsFontFamily)cboFonts.SelectedItem;

string n = f.Path.Substring(f.Path.LastIndexOf("\\")+1);

File.Copy(f.Path, iPath + "\\" + n, false);

SendMessage((System.IntPtr)HWND_BROADCAST, WM_FONTCHANGE, 0, 0);

int i = AddFontResource(iPath + "\\" + n);

}

Thx in advance.

Nov 15 '05 #2

P: n/a
2G
Yep, did that but with the same result.

Grtz.

"Stoitcho Goutsev (100) [C# MVP]" <10*@100.com> wrote in message
news:OY**************@TK2MSFTNGP11.phx.gbl...
Hi 2G,
Probably you should notify after adding the font to the fornt resource pool. Have you tried to change places of SendMessage and AddFontResource calls.

--
HTH
B\rgds
100
"2G" <2g@pandora.be> wrote in message
news:5k******************@phobos.telenet-ops.be...
Hi everybody

I think i'm doing something wrong . :)

When I install a new font, all my programs (like photoshop) that are running
don't respond anymore for like 2 min, after that I can use the font

whitout
restarting the applications but I can not delete the font untill i

reboot my
pc (i tried killing all processes but that didn't work).

If anyone would take a look , I do the following :

[DllImport("user32.dll", CharSet=CharSet.Auto)] static extern IntPtr
SendMessage(IntPtr hwnd, int msg, int wParam, int lParam);

private const int HWND_BROADCAST = 0xffff;

private const int WM_FONTCHANGE = 0x001D;

private void cmdInstall_Click(object sender, System.EventArgs e){

clsFontFamily f = (clsFontFamily)cboFonts.SelectedItem;

string n = f.Path.Substring(f.Path.LastIndexOf("\\")+1);

File.Copy(f.Path, iPath + "\\" + n, false);

SendMessage((System.IntPtr)HWND_BROADCAST, WM_FONTCHANGE, 0, 0);

int i = AddFontResource(iPath + "\\" + n);

}

Thx in advance.


Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.