Jump to content

Recommended Posts

Posted

I've designed a programme in VB6 for college, using a font that I downloaded here:

 

Free Font Download - Super Mario Bros. font | UrbanFonts.com

 

Had no problems with it until I tried to test it on other machines. The font appears fine on my machine (obviously as I designed the app using it) but the font doesn't work on any other machine I've tried.

 

Opening the font on my machine displays the mappings to letters (as normal). Opening the font on other machines (3 laptops in my house, all Win XP SP2 - same as my desktop which works) shows an empty file, apart from the title and the 10, 12, 14 etc at the side.

 

Does this make sense? What the hell is going on?

Posted
Did you enjoy your little convo :) sometimes it helps to just post replys to yourself :p

 

It's called debugging by conversation - doesn't matter if the conversation is with yourself obviously.

Posted
Ah, but I haven't figured out the problem yet. I want to know why I need to restart in order to pick up the font, and if there's anything I can do to combat this. :(
Posted
you may have less issues with a programming language from this decade :)

 

Yeah, unfortunately it's been forced on me to use VB6.

 

I was really getting into it and enjoying using it, until it came to testing on other machines and getting all types of errors.

 

Missing DLL's, and run-time errors, and fonts not loading until after a reboot. :@

Posted
You don't actually need a reboot; what you have to do is send a message to the top level window saying that there has been a change of font(s). That's what the tektips web page is doing (although in vb.net; this page has a VB6 example which will be easier to crib!)

 

I have a splash screen that only shows an image, and loads the font. Should I still need to do this?

 

What does this message do exactly (I mean can you explain so I understand).

 

Thanks,

Posted (edited)
I have a splash screen that only shows an image, and loads the font. Should I still need to do this?

 

What does this message do exactly (I mean can you explain so I understand).

 

Thanks,

 

The add font resource bit adds the font to the fonts folder and registers them then the message is sent to all of the window handles that represent open program windows just tells them that there are new fonts present in the system and so they should redraw. You would probably still need to do this as your main program window may retain the same window handle as the splash screen depending on how your program is built. The msgbox line at the end is unnessisary and is just for debugging.

 

If it is just for a splash screen why not just use a bitmap, it would be easier and much more portable solution.

Edited by SYNACK
  • Thanks 1
Posted
If it is just for a splash screen why not just use a bitmap, it would be easier and much more portable solution.

 

Thanks, my app is at home so I will try it tonight and let you all know how I get on.

 

As for the bitmap, the splash screen only shows a bitmap/gif/whatever, but I need the font for the rest of the app. (labels, text box's etc etc).

Posted

 

What does this message do exactly (I mean can you explain so I understand).

 

 

I think @synack has answered this but I can always try and muddy the water :-)

 

Some things in Windows are only read at startup or logon - the list of available fonts is one of those things. When you install a font by dragging it into c:\windows\fonts (or adding it with control panel) you not only copy the font to that folder but you also add a registry key giving info about the font and (most important) tell Explorer and all other interested processes (eg your VB program) that there are new fonts available and that they should re-read the list.

 

This idea of "telling" processes what's going on is called message passing - Windows (and most other modern operating systems) work like this. Messages can be passed from any process to any other process and can also be sent to the "top level" process which will then notify everything else that a change has happened.

  • Thanks 1
Posted
I think @synack has answered this but I can always try and muddy the water :-)

 

Some things in Windows are only read at startup or logon - the list of available fonts is one of those things. When you install a font by dragging it into c:\windows\fonts (or adding it with control panel) you not only copy the font to that folder but you also add a registry key giving info about the font and (most important) tell Explorer and all other interested processes (eg your VB program) that there are new fonts available and that they should re-read the list.

 

This idea of "telling" processes what's going on is called message passing - Windows (and most other modern operating systems) work like this. Messages can be passed from any process to any other process and can also be sent to the "top level" process which will then notify everything else that a change has happened.

 

Thanks Steve,

 

When I install fonts some apps pick them up straight away - is this because they use this 'messaging'? Where as because my VB doesn't it needs a restart?

Posted
When I install fonts some apps pick them up straight away - is this because they use this 'messaging'? Where as because my VB doesn't it needs a restart?

 

When you install fonts by dragging them into the fonts folder manually windows usually takes care of the font registration instantly where as a programatic file copy does not. Some apps (like office) do seem to trigger a poll of the fonts and update themselves if opened afterwards. They may send a message out to rescan for fonts from the registry on every start

Posted (edited)
When you install fonts by dragging them into the fonts folder manually windows usually takes care of the font registration instantly where as a programatic file copy does not. Some apps (like office) do seem to trigger a poll of the fonts and update themselves if opened afterwards. They may send a message out to rescan for fonts from the registry on every start

 

if you use the API ( SHFILEOPERATION ) or whatever the API is called -to copy a file instead of using the FSO would that make any difference to windows registering the font ?

 

http://vbnet.mvps.org/index.html?code/shell/shfileopadv.htm

Edited by mac_shinobi
Posted

Hey folks, I've added the Send Message function and it didn't work.

 

I think it might be the font I'm using as I don't seem to be having the problem with other fonts. How bizarre though?

Posted
if you use the API ( SHFILEOPERATION ) or whatever the API is called -to copy a file instead of using the FSO would that make any difference to windows registering the font ?

 

 

It certainly works in VBScript - that's how I add new fonts to machines in a script. I'd expect it to work in VB but I don't have VB6 to try it :-(

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...