|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Installing FontsI'm very new to writting VBScripts and I've written a VBScript to install
fonts into the C:\Windows\system32\fonts folder. The script is running fine and it is being handled by group policy for a bunch of computers. The problem is that I can see that the files have been copied but the users can't use the fonts until I log on to each pc as local admin and go to control panel and then click on the fonts folder. Then, the fonts are available. What do I need to do to my script to have the fonts available without that step? Thanks for any help. Bob > I'm very new to writting VBScripts and I've written a VBScript to install Anything to do with fonts and Windows is a complete mess, to install a font properly for all users it's a three-step> fonts into the C:\Windows\system32\fonts folder. The script is running fine > and it is being handled by group policy for a bunch of computers. > > The problem is that I can see that the files have been copied but the users > can't use the fonts until I log on to each pc as local admin and go to > control panel and then click on the fonts folder. Then, the fonts are > available. What do I need to do to my script to have the fonts available > without that step? process: First off, copy or move the file into the fonts directory, nice and easy to get you started. Next you need to call the AddFontResource(Ex) API call to install the font (you may also need to call CreateScalableFontResource(), depending on which font it is.) Ok, so far so good - This is unfortunately where the documentation ends.. Finally you need to add an entry into the registry to tell Windows where the font is. Have a look at [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts] to see what's already there for existing fonts, it should be pretty simple to work out what to add for your own - Oh and yes, the location of this key changes depending on which OS the user is running - fun! But unfortunately with this method you have to find out the font name to install it with, you can't just use the file name - that would be too easy, and no there are no API calls to find this for you. You can either parse the .TTF file (www.wotsit.org should have the format spec, you're interested in the name resource) or I've also seen a technique that parses the .FOT file generated by CreateScalableFontResource() which supposedly has the font name in, I've not experimented with this yet though. To make sure any currently running applications are made aware of the newly installed font, you need to broadcast the WM_FONTCHANGE message to all top-level windows (just use SendMessage() with the HWND_BROADCAST flag for the window handle.) After all that you may have the font properly installed.. good luck.. ;) Hope this helps, Mike - Microsoft Visual Basic MVP - E-Mail: ED***@mvps.org WWW: Http://EDais.mvps.org/
Show quote
Hide quote
"Mike D Sutton" <ED***@mvps.org> wrote in message font properly for all users it's a three-stepnews:u9cf%2399XFHA.2588@TK2MSFTNGP14.phx.gbl... > > I'm very new to writting VBScripts and I've written a VBScript to install > > fonts into the C:\Windows\system32\fonts folder. The script is running fine > > and it is being handled by group policy for a bunch of computers. > > > > The problem is that I can see that the files have been copied but the users > > can't use the fonts until I log on to each pc as local admin and go to > > control panel and then click on the fonts folder. Then, the fonts are > > available. What do I need to do to my script to have the fonts available > > without that step? > > Anything to do with fonts and Windows is a complete mess, to install a > process: to get you started.> First off, copy or move the file into the fonts directory, nice and easy > Next you need to call the AddFontResource(Ex) API call to install the font (you may also need to call> CreateScalableFontResource(), depending on which font it is.) Ok, so far so good - This is unfortunately where the> documentation ends.. the font is. Have a look at> Finally you need to add an entry into the registry to tell Windows where > [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts] to see what's already there for existing fonts,> it should be pretty simple to work out what to add for your own - Oh and yes, the location of this key changes depending> on which OS the user is running - fun! install it with, you can't just use the file> But unfortunately with this method you have to find out the font name to > name - that would be too easy, and no there are no API calls to find this for you. You can either parse the .TTF file> (www.wotsit.org should have the format spec, you're interested in the name resource) or I've also seen a technique that> parses the .FOT file generated by CreateScalableFontResource() which supposedly has the font name in, I've not> experimented with this yet though. That's opening a huge can of worms and looks easy at first until you realizeit's not a consistant way to get the font's face name. Fonts are just not easy to work with. I have spent alot of time with Fonts and the font specifications for my shareware application www.CfontPro.com . > To make sure any currently running applications are made aware of the newly installed font, you need to broadcast the> WM_FONTCHANGE message to all top-level windows (just use SendMessage() with the HWND_BROADCAST flag for the window> handle.) > After all that you may have the font properly installed.. good luck.. ;) > Hope this helps, > > Mike > > > - Microsoft Visual Basic MVP - > E-Mail: ED***@mvps.org > WWW: Http://EDais.mvps.org/ > > -- Chris Hanscom - Microsoft MVP (VB) Veign's Resource Center http://www.veign.com/vrc_main.asp -- Read. Decide. Sign the petition to Microsoft. http://classicvb.org/petition/ > That's opening a huge can of worms and looks easy at first until you realize Which method do you use, parsing the font table in the TTF? If so how do you decide which string in the table to use?> it's not a consistant way to get the font's face name. Fonts are just not > easy to work with. I have spent alot of time with Fonts and the font > specifications for my shareware application www.CfontPro.com . I'm currently assigning a weight to each entry based on the type, language and platform fields for each string (at least I think that's what they are, it's been a while since I looked at the format..) and pick the entry with the highest weight overall. It seems a bit flakey though but so far has proven to be pretty reliable, still I'm curious as to how others have done it. I have a couple of utility applications that currently use my font installation library and I still cringe at how presumptuous the code is, I've no idea what would happen if it were run on a non-English system since I've never had a chance to test the language mapping stuff! If your brain is available for picking on the subject then it would be much appreciated, either very few people seem to know or once they have figured it out they don't want to share any information on the subject which is very frustrating! Cheers, Mike - Microsoft Visual Basic MVP - E-Mail: ED***@mvps.org WWW: Http://EDais.mvps.org/ I will respond to this as soon as I get a free moment...
-- Chris Hanscom - Microsoft MVP (VB) Veign's Resource Center http://www.veign.com/vrc_main.asp -- Read. Decide. Sign the petition to Microsoft. http://classicvb.org/petition/ "Mike D Sutton" <ED***@mvps.org> wrote in message you decide which string in the table to use?news:uPNltVEYFHA.2664@TK2MSFTNGP15.phx.gbl... > > That's opening a huge can of worms and looks easy at first until you realize > > it's not a consistant way to get the font's face name. Fonts are just not > > easy to work with. I have spent alot of time with Fonts and the font > > specifications for my shareware application www.CfontPro.com . > > Which method do you use, parsing the font table in the TTF? If so how do > I'm currently assigning a weight to each entry based on the type, language and platform fields for each string (at least> I think that's what they are, it's been a while since I looked at the format..) and pick the entry with the highest> weight overall. It seems a bit flakey though but so far has proven to be pretty reliable, still I'm curious as to how> others have done it. I have a couple of utility applications that currently use my font installation library and I> still cringe at how presumptuous the code is, I've no idea what would happen if it were run on a non-English system> since I've never had a chance to test the language mapping stuff! much appreciated, either very few people seem to> If your brain is available for picking on the subject then it would be > know or once they have figured it out they don't want to share any information on the subject which is very frustrating!Show quoteHide quote > Cheers, > > Mike > > > - Microsoft Visual Basic MVP - > E-Mail: ED***@mvps.org > WWW: Http://EDais.mvps.org/ > >
Need some help in compressing bmp file to jpeg file
Get rid of flicker inside a frame. VB6 don't see events of the implemented interface checkbox always is disabled!!!! Simulating relational database with text files load extern exe file into mdi framework? X-axis value of Excel chart Optimizing Binary File Input Run-Time error '-2147024769 (8007007f)' Import Wizard for VB.Net |
|||||||||||||||||||||||