Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Need code to determine the monitor/screen setting 'small font' or 'large font'
I have code for screen resolution In Control Panel, 'Display', my 'Settings' advanced tab shows 'small font 96 dpi normal' TIA |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub GetScreenFont()
MsgBox GetDeviceCaps(GetDC(0), 88), vbOKOnly _ + vbInformation, "Screen Font Size" End Sub Assuming you have already declared the GetDC and GetDeviceCaps functions to get the screen resolution. -- Vasant "Tom Rudski" wrote in message ... Need code to determine the monitor/screen setting 'small font' or 'large font'. I have code for screen resolution. In Control Panel, 'Display', my 'Settings' advanced tab shows 'small font 96 dpi normal'. TIA |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Make sure that you release the DC, see
http://msdn.microsoft.com/library/de...vcons_4esj.asp -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message ... Sub GetScreenFont() MsgBox GetDeviceCaps(GetDC(0), 88), vbOKOnly _ + vbInformation, "Screen Font Size" End Sub Assuming you have already declared the GetDC and GetDeviceCaps functions to get the screen resolution. -- Vasant "Tom Rudski" wrote in message ... Need code to determine the monitor/screen setting 'small font' or 'large font'. I have code for screen resolution. In Control Panel, 'Display', my 'Settings' advanced tab shows 'small font 96 dpi normal'. TIA |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Bob:
I didn't realize the DC needed to be released if you weren't doing anything with it (besides getting the handle), but my API knowledge would probably fit on the head of a pin <g. Regards, Vasant. "Bob Phillips" wrote in message ... Make sure that you release the DC, see http://msdn.microsoft.com/library/de...vcons_4esj.asp -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message ... Sub GetScreenFont() MsgBox GetDeviceCaps(GetDC(0), 88), vbOKOnly _ + vbInformation, "Screen Font Size" End Sub Assuming you have already declared the GetDC and GetDeviceCaps functions to get the screen resolution. -- Vasant "Tom Rudski" wrote in message ... Need code to determine the monitor/screen setting 'small font' or 'large font'. I have code for screen resolution. In Control Panel, 'Display', my 'Settings' advanced tab shows 'small font 96 dpi normal'. TIA |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Vasant,
you probably haven't run into the problems that can arise, so it didn't seem like an issue. Defensive programming<vbg -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message ... Hi Bob: I didn't realize the DC needed to be released if you weren't doing anything with it (besides getting the handle), but my API knowledge would probably fit on the head of a pin <g. Regards, Vasant. "Bob Phillips" wrote in message ... Make sure that you release the DC, see http://msdn.microsoft.com/library/de...vcons_4esj.asp -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message ... Sub GetScreenFont() MsgBox GetDeviceCaps(GetDC(0), 88), vbOKOnly _ + vbInformation, "Screen Font Size" End Sub Assuming you have already declared the GetDC and GetDeviceCaps functions to get the screen resolution. -- Vasant "Tom Rudski" wrote in message ... Need code to determine the monitor/screen setting 'small font' or 'large font'. I have code for screen resolution. In Control Panel, 'Display', my 'Settings' advanced tab shows 'small font 96 dpi normal'. TIA |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here's a slightly modified bit of code from Randy Birch
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''' ' Copyright ©1996-2004 VBnet, Randy Birch, All Rights Reserved. ' Some pages may also contain other copyrights by the author. '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''' ' Distribution: You can freely use this code in your own ' applications, but you may not reproduce ' or publish this code on any web site, ' online service, or distribute as source ' on any media without express permission. Private Declare Function GetDesktopWindow Lib "user32" _ () As Long Private Declare Function GetDC Lib "user32" _ (ByVal hwnd As Long) As Long Private Declare Function GetDeviceCaps Lib "gdi32" _ (ByVal hdc As Long, _ ByVal nIndex As Long) As Long Private Declare Function ReleaseDC Lib "user32" _ (ByVal hwnd As Long, _ ByVal hdc As Long) As Long Private Const LOGPIXELSX = 88 Private Const LOGPIXELSY = 90 Public Function ScreenFont() As String Dim hWndDesk As Long Dim hDCDesk As Long Dim logPix 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 Call ReleaseDC(hWndDesk, hDCDesk) 'if the return from GetDeviceCaps is 96, then 'the system is using small fonts. If logPix = 96 Then ScreenFont = "Small" Else ScreenFont = "Large" End If End Function -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Tom Rudski" wrote in message ... Need code to determine the monitor/screen setting 'small font' or 'large font'. I have code for screen resolution. In Control Panel, 'Display', my 'Settings' advanced tab shows 'small font 96 dpi normal'. TIA |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Large / Small | Excel Discussion (Misc queries) | |||
Font & Cell colors are not showing up on my monitor in Excel. | Setting up and Configuration of Excel | |||
spreadsheet prints so small even with large font | Excel Discussion (Misc queries) | |||
SMALL and LARGE | Excel Discussion (Misc queries) | |||
How to display multiple pages on one large monitor | Excel Discussion (Misc queries) |