473,396 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

SendMessage, fonts

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
2 7028
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Mark Overstreet | last post by:
I am trying to click a button in another window and I have it's hWnd value so I was trying to use Send message. Here is my code but it doesn't work as expected... response =...
3
by: JSK | last post by:
Hi, As any one worked in VB.NET and made use of Sendmessage API? The Issue I am running into is how to pass pointers of Data Structures (UDT) to the SendMessage. I starting looking at "IntPrt"...
0
by: SamSpade | last post by:
In my C# library I have many SendMessages like the following: public static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, ref PARAFORMAT2 pf2); I use this one like this:
3
by: Rob | last post by:
Hi all, I am having trouble converting the code below (found on http://vbnet.mvps.org/index.html?code/core/sendmessage.htm) into a format that will work using vb .NET. Can anyone have a look...
18
by: Lars Netzel | last post by:
Hello! Thanx to this newgroup I have finally, with the help of you guys, gotten this to work halfway.. but the final action is still not working, clicking the "Button2" thru SendMessage(). ...
4
by: Abubakar | last post by:
Hi, My application has a lot of threads which at some point call SendMessage api passing it the handle of the gui window. The calls r a lot. My question is that should I call the SendMessage api...
22
by: SQACSharp | last post by:
I'm trying to get the control name of an editbox in another window. The following code set the value "MyPassword" in the password EditBox but it fail to return the control name of the EditBox. ...
1
by: Necromis | last post by:
Ok, I have gotten my head around things better regarding SendMessage and FindWindow functions. However, I am running into an issue with my code still. The program I am working with is EXTRA! by...
5
by: michelqa | last post by:
Hi, I need to call a lot of different native SendMessage to retreive informations from non managed application. Some win32 messages use struct pointer for lparam....how to create and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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,...

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.