Results 1 to 13 of 13
  1. #1
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Piscataway, New Jersey, USA
    Posts
    171
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Adjust Windows Font Size (Office 2000)

    Hi everybody:

    I've done a custom app in Access2000/VBA that I'm ready to deploy. I found some API code for getting the user's screen size and resolution, changing them so the app will display properly, and then restoring them. Great! But some of my users have changed their Windows font size (I found it in the Active Titlebar setting in Control Panel, Display, Appearance on their PCs) to Extra Large. This overrides my windows settings, as Windows adjusts the window size to accommodate the user's preference. So, my app still does'nt display properly for them.

    How can I override this behavior? I don't find a flag for font size anywhere, nor for the active title bar. The worst aspect is that after my app closes, the user's desktop display is too large, hiding their MS start button and task bar! I can get the Start menu back by clicking the Windows keyboard button, but the only way I've found to get the task bar back is to manually open Control Panel, and change the font size for the Active Titlebar, which seems to reset it.

    Anyone know how to outsmart Windows on this?

    Thanks!

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Adjust Windows Font Size (Office 2000)

    In general you are taking a dangerous tack when you start changing the screen resolution for an application. The problem is that not all display cards behave quite the same, and the API code for doing that may in some cases need to change from one version of Windows to another. And as far as I know, there isn't a way of detecting whether the default Windows font size has been increased - though I don't claim to be an expert on all of the API calls you can make. Personally, I don't like applications changing my screen resolution - I have a game that does that and it drives me nuts. In addition, if I have several other applications open, they are all the wrong size when you switch the them.

    The generally accepted wisdom on this issue is to pick a minimum screen size and design your application for that. If the user want's to run at 1600x1200, or with dual monitors like I do, they have an application that doesn't fill the whole screen, or looks a bit wonky if they maximize it. We usually design for 800x600 small fonts - if users want to run 640x480, then they will have to scroll or do other tricks. The advantage is that 1024x768 large fonts still looks pretty good, and provides just a bit more screen real estate.

    Sorry to not have a better solution - maybe one of the other loungers has more knowledge in this area. <img src=/S/crossfingers.gif border=0 alt=crossfingers width=17 height=16>
    Wendell

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Adjust Windows Font Size (Office 2000)

    I agree with Wendell - changing resolutions is tricky.

    In the office where I work, the IT department has disabled changing screen resolution interactively, but applications can still change it using API calls. I once got an Access utility that could do this. As a test, I changed my resolution from 1024x768 to 640x480 and back. It worked, but switched my monitor to a much lower refresh frequency, resulting in a very unpleasant flickering image. I had no way to change the frequency myself! (Fortunately, a hard reset got things back to normal, but that is not something you want to do every time you've used an Access database.)

    So find what resolution your users have, and develop for the smallest of those. Nowadays, as Wendell wrote, it's mostly 800x600, but probably the time when everyone will have at least 1024x768 is not far off.

  4. #4
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Piscataway, New Jersey, USA
    Posts
    171
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adjust Windows Font Size (Office 2000)

    Thanks for your insights. However, re-designing the application is not an option at this point. Any other ideas?

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Adjust Windows Font Size (Office 2000)

    You probably need the SystemParametersInfo Windows API function to get and set system font sizes, but that's beyond my ken.

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Adjust Windows Font Size (Office 2000)

    What is it you expect to do that isn't happening? Once you close your application, you can't reset anything because the code is no longer running. You would have to change the settings back before you closed the application. Changing font sizes is a bad idea, as you have seen from your own experience, and you can never rely on having a vanilla setup on a user's machine. <img src=/S/nope.gif border=0 alt=nope width=15 height=15>

    You can find help on API calls at http://www.allapi.net, but using the wrong calls can totally mess up a machine because you are actually talking to Windows at that point and a lot of the safety nets built into the application engines are removed when you do that. Since there are well over a thousand API calls for the recent versions of Windows, trying to use them properly can be a daunting task. You might want to take a look at some of the tools on Stephan Lebans site. He has built some handy utilities and there might be something there you could use.
    Charlotte

  7. #7
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Adjust Windows Font Size (Office 2000)

    Hi Kathryn,

    Sorry for not responding sooner, especially since I was the first responder - we had a family emergency that required my attention. What resolution did you design your application for? Also are you maximizing your application so it fills the entire display? I don't think any of us are suggesting you should redesign your application - the bottom line for at least most of us is we insist the user play by our rules and not run huge fonts at low resolutions, use weird color palletes, etc.

    If you think you really have to try to set and reset fonts, the best info I've found on making API calls is in the Access Developer's Handbook, in the VBA Developer's Handbook, and in Alison Balter's Mastering Access Desktop Development, but none really deal with manipulating font information, and contain a number of cautions and warnings about the problems that can develop. I believe the Developer Version of Office contains some tools that are useful in working with API calls - do you have that version? Finally, the website that Charlotte pointed you to is the best source of information on API calls that I know of. We would be very interested in knowing your progress if you do decide to try to change font sizes.
    Wendell

  8. #8
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Piscataway, New Jersey, USA
    Posts
    171
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adjust Windows Font Size (Office 2000)

    Hi Wendell, et. al:

    I developed the app for 1024x 768 resolution. My Access window is maximized. Due to the complexity of some of the major forms (which contain subforms), I need the full screen to display. The code I'm using gets the user's screen resolution and size settings, saves them to a table, prompts the user that the resolution should be changed for the app, changes it, and then restores the user's settings on exit. Works fine, except for the 2 users who are using enlarged (giant) fonts, which appear in all the menu bars, etc. in my app., pushing the screen display to accommodate them.

    The best place to search for API info seems to be google, as long as you know what to "ask" for (the API call name or structure name).

    I found an article called "Non-Client Metrics" and a VB6 app on thescarns.com that seems to work for changing screen resolution but doesn't address fonts. The links are:

    http://www.thescarms.com/VBasic/sysparam.asp

    http://www.thescarms.com/VBasic/chgres.asp

    I don't have the Developer version; just Access 2000 professional.

    I plan to test a couple of approaches out tomorrow and will keep you posted.

    Thanks,

  9. #9
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adjust Windows Font Size (Office 2000)

    Hi Kathryn,

    I realize this may be a late suggestion, but I was able to devise a soultion to a similar problem several years ago (thanks to the help of several wonderful Loungers here...).

    This sample uses API calls to resize the desktop to the desired size (800x600 in this case) when the user opens the database. Then, it changes it back to their original resoultion on close. It uses the OnClose event of a hidden form to trigger the second resize.

    Although I posted this a while back, I think re-posting it will be forgiven due to the temporary lack of a lounge Search feature.

    Please let me know if you have any questions, although it's been almost 2 years since I've touched this! (It's in Access 97 format, but can be used with any version.)
    I hope this helps!
    Attached Files Attached Files

  10. #10
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Piscataway, New Jersey, USA
    Posts
    171
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Works like a charm!

    Hi Mark:

    Good to hear from you! I found your code while searching this forum a couple of weeks ago, updated it for Windows 2000, and added it to my app (with a credit to you, natch). My problem was with a user who had changed his Windows fonts to extra large, which was enlarging his windows to accommodate it and pushing his taskbar off the screen after it was restored.

    I found a simple solution by adding a line of code to refresh the task bar on exit and changing this particular user to an even finer screen resolution. Now, my app displays perfectly on his screen, and when it exits, his task bar sits nicely at the bottom.
    Just add the "show = true" statement to the bottom of your RestoreResolution routine (having put a "show = false" statement at the end of your ChangeResolution routine), like so:

    If intAnswer = vbYes Then
    'Call function fChangeRes from basChangeResolution to restore user's preferences
    'If that call succeeds, set old values in tblPreferences back to their defaults (nulls)
    If fChangeRes(intResX, intResY) = True Then
    rst.MoveFirst
    rst.Edit
    fldChanged = False
    fldResX = Null
    fldResY = Null
    rst.Update
    rst.Close
    Show = True 'Calls API from modTaskBar to show Windows task bar
    Else
    GoTo Error_Handler
    End If

    and add this to a module:

    Public Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Public Property Let Show(ByVal VShow As Boolean)
    TBwnd& = FindWindow("Shell_traywnd", "")

    If VShow = True Then
    'if TaskBar.Show=true it shows the TaskBar
    ShowWnd& = ShowWindow(TBwnd&, 1)
    Else
    'if not it hides the TaskBar
    ShowWnd& = ShowWindow(TBwnd&, 0)
    End If
    End Property


    Thanks to everyone who has responded to my post, I'll be finishing this project on schedule!

  11. #11
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Works like a charm!

    Kathryn,

    Brilliant!

    In my initial use of the Resolution code (originally found on The Access Web) I did not dig deep enough to discover the Show Taskbar function. I knew it was an issue but was unable to follow through to find the answer.

    I'll update my code sample to include the Show Taskbar code you've included (with credit to you, natrually <img src=/S/bow.gif border=0 alt=bow width=15 height=15>).

    I'm glad to hear that your application is coming along nicely!

    Best,

  12. #12
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Piscataway, New Jersey, USA
    Posts
    171
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Works like a charm!

    Thanks!

    I hope my users like it. If they insist on using giant fonts and elect not to change their screen resolution, they'll have to use scroll bars to navigate the big forms, because I'm out of development time and am trying to finish up the documentation. (Really, why do I let users do these things?!)

    Giving credit where credit is due, I modified some code I found on the AllApi.net forum (no author given).

  13. #13
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Works like a charm!

    Glad you were able to persevere and solve the problem - the answer may be useful to other loungers in the future. In the mean time, I think your summary
    <hr>If they insist on using giant fonts and elect not to change their screen resolution, they'll have to use scroll bars to navigate the big forms. . .<hr>
    is the answer most of us resort to when your users insist on tweaking your world.
    Wendell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •