Hightower Posted February 16, 2009 Posted February 16, 2009 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?
Hightower Posted February 16, 2009 Author Posted February 16, 2009 Here's the font appearance on my desktop. I'll post another one (got to post from laptop) to show the not working image.
Hightower Posted February 16, 2009 Author Posted February 16, 2009 WTF!?! I can't post an image now, cos just turned my laptop on and its working all of a sudden! Can't understand this?!
Hightower Posted February 16, 2009 Author Posted February 16, 2009 OK, it seems a restart fixes things? Why? All I want is a simple font to be included as part of the app. What a pain!
EduTech Posted February 16, 2009 Posted February 16, 2009 Did you enjoy your little convo sometimes it helps to just post replys to yourself
leco Posted February 16, 2009 Posted February 16, 2009 Did you enjoy your little convo sometimes it helps to just post replys to yourself It's called debugging by conversation - doesn't matter if the conversation is with yourself obviously.
EduTech Posted February 16, 2009 Posted February 16, 2009 yup! i have it quite regular as some people who have me on msn would know!
mac_shinobi Posted February 16, 2009 Posted February 16, 2009 Did you enjoy your little convo sometimes it helps to just post replys to yourself Aint life grand when you have a split personality and can figure out your own problems lol
Hightower Posted February 16, 2009 Author Posted February 16, 2009 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.
mac_shinobi Posted February 16, 2009 Posted February 16, 2009 reboot = so windows re registers the fonts. You could of course re load the users hive of the registry : Batch files - RUNDLL and RUNDLL32
SYNACK Posted February 17, 2009 Posted February 17, 2009 This should do it: How to Install a barcode font at runtime under Windows XP - Visual Basic(Microsoft) -VB.NET 2002-2008 FAQ - Tek-Tips you may have less issues with a programming language from this decade 1
Hightower Posted February 17, 2009 Author Posted February 17, 2009 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. :@
srochford Posted February 17, 2009 Posted February 17, 2009 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!)
Hightower Posted February 17, 2009 Author Posted February 17, 2009 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,
SYNACK Posted February 17, 2009 Posted February 17, 2009 (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 February 17, 2009 by SYNACK 1
Hightower Posted February 17, 2009 Author Posted February 17, 2009 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).
srochford Posted February 17, 2009 Posted February 17, 2009 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. 1
Hightower Posted February 17, 2009 Author Posted February 17, 2009 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?
SYNACK Posted February 17, 2009 Posted February 17, 2009 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
mac_shinobi Posted February 17, 2009 Posted February 17, 2009 (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 February 17, 2009 by mac_shinobi
Hightower Posted February 17, 2009 Author Posted February 17, 2009 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?
srochford Posted February 17, 2009 Posted February 17, 2009 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 :-(
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now