Solved

Font Changes

Posted on 1998-07-08
5
182 Views
Last Modified: 2013-12-03
I have written a program while my settings on my computer is for small font.  When  I put the same program on machines for my users some of them have changed thier display setting to large font.  WHen this is the case my visual basic screens don't fit on the screen.  Is there a way to tell the program when it loads to someway change the settings or some other way to get around this problem..other than making sure all users have thier display set a certain way?
0
Comment
Question by:kellyegg
  • 2
  • 2
5 Comments
 
LVL 7

Expert Comment

by:kamall
ID: 1465257
kellyegg,
As far as I know, this problem can not be solved even if you resize your form and controls for the specific screen resolution on the user's machine. The only way to solve it is that the user must change his font size to small fonts.
0
 
LVL 6

Accepted Solution

by:
anthonyc earned 30 total points
ID: 1465258
Kelly....

Here is some code to detect if the user has large or small fonts.   Send me an email at aecornetto@sai2000.com and we can attempt to work out something that will change the setting.  This only reads the setting:

   Public Declare Function GetDesktopWindow Lib "user32" () As Long

   Public Declare Function GetDC Lib "user32" _
     (ByVal hwnd As Long) As Long

   Public Declare Function GetDeviceCaps Lib "gdi32" _
     (ByVal hdc As Long, ByVal nIndex As Long) As Long

   Public Declare Function ReleaseDC Lib "user32" _
     (ByVal hwnd As Long, ByVal hdc As Long) As Long

   Public Const LOGPIXELSX = 88
   Public Const LOGPIXELSY = 90

Private Function IsScreenFontSmall() As Boolean

    Dim hWndDesk As Long
    Dim hDCDesk As Long
    Dim logPix As Long
    Dim r As Long
   
   'get the handle to the desktop window  
    hWndDesk = GetDesktopWindow()
   
   'get the handle desktop display context (hDC)  
    hDCDesk = GetDC(hWndDesk)
   
   'get the horizontal logical pixels  
    logPix = GetDeviceCaps(hDCDesk, LOGPIXELSX)
   
   'release the hDC  
    r = ReleaseDC(hWndDesk, hDCDesk)
   
   'if the return from GetDeviceCaps is 96, then the system is
   'using small fonts.  If the system is using small fonts,
   'the return value will be 96.  
    IsScreenFontSmall = logPix = 96
 
End Function

sub main
   if isscreenfontsmall then msgbox "The screen font is small"
end sub
0
 

Author Comment

by:kellyegg
ID: 1465259
The previous answer was good but not exactly what I was looking for.... I have found a function dealing wiht a sub routine called display changed that I found in the online help.  I can not get it to work correctly and I would like to know if anyone knew anything about the sysinfo control function? thanks
0
 
LVL 6

Expert Comment

by:anthonyc
ID: 1465260
Kelly..

send me an email... We can work this out together....   The sysinfo control is pretty weak...  

Anthony

aecornetto@sai2000.com
0
 

Author Comment

by:kellyegg
ID: 1465261
I have been working with the sysinfo control and can not get it to work...I put a control on my form and when I restart the computer it does nothing!! Does anyone else have any ideas?
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now