A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows XP » General XP issues or comments
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

API basics and getdevicecaps



 
 
Thread Tools Display Modes
  #1  
Old November 24th 08, 07:31 PM posted to microsoft.public.windowsxp.general
jay
external usenet poster
 
Posts: 168
Default API basics and getdevicecaps

Hi -

WinXPProSP2/Office 2003: I'm programming in MS Access VBA and need to call a
WinAPI function. I'm new to coding API calls, so I don't yet understand the
conventions very well.

My specific goal is to determine the number of pixels per physical inch of
screen -both horizontally and vertically - for use elsewhere in my
application. From what I can tell, the 'getdevicecaps' function provides
pixels-per-inch (PPI), but I don't know how to implement it in VBA. So far,
I have the following code in a VBA module and would appreciate any advice on
how to code the function arguments (and anything else necessary to get this
to work properly):

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

Public Function GetHPixelsPerInch() As Long
'Get horizontal pixels per inch
pixH = GetDeviceCaps(I don't know what goes here)
GetHPixelsPerInch = pixH
End Function

Public Function GetVPixelsPerInch() As Long
'Get vertical pixels per inch
pixV = GetDeviceCaps(I don't know what goes here)
GetVPixelsPerInch = pixV
End Function

Sub screenPixPerInch()
MsgBox "X PPI = " & GetHPixelsPerInch & Chr(13) & _
"Y PPI = " & GetVPixelsPerInch
End Sub
-----------
Thanks,
Jay

Ads
  #2  
Old November 24th 08, 08:54 PM posted to microsoft.public.windowsxp.general
jay
external usenet poster
 
Posts: 168
Default API basics and getdevicecaps

Please disregard this post; I have re-posted in Discussions in Windows API.

"Jay" wrote:

Hi -

WinXPProSP2/Office 2003: I'm programming in MS Access VBA and need to call a
WinAPI function. I'm new to coding API calls, so I don't yet understand the
conventions very well.

My specific goal is to determine the number of pixels per physical inch of
screen -both horizontally and vertically - for use elsewhere in my
application. From what I can tell, the 'getdevicecaps' function provides
pixels-per-inch (PPI), but I don't know how to implement it in VBA. So far,
I have the following code in a VBA module and would appreciate any advice on
how to code the function arguments (and anything else necessary to get this
to work properly):

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

Public Function GetHPixelsPerInch() As Long
'Get horizontal pixels per inch
pixH = GetDeviceCaps(I don't know what goes here)
GetHPixelsPerInch = pixH
End Function

Public Function GetVPixelsPerInch() As Long
'Get vertical pixels per inch
pixV = GetDeviceCaps(I don't know what goes here)
GetVPixelsPerInch = pixV
End Function

Sub screenPixPerInch()
MsgBox "X PPI = " & GetHPixelsPerInch & Chr(13) & _
"Y PPI = " & GetVPixelsPerInch
End Sub
-----------
Thanks,
Jay

  #3  
Old November 27th 08, 02:33 AM posted to microsoft.public.windowsxp.general
Kelly
external usenet poster
 
Posts: 1,621
Default API basics and getdevicecaps

Start here, Jay.
http://www.microsoft.com/technet/scr...r/default.mspx

--

All the Best and Happy Turkey Day,
Kelly (MS-MVP/DTS&XP)

Taskbar Repair Tool Plus!
http://www.kellys-korner-xp.com/taskbarplus!.htm


"Jay" wrote in message
...
Hi -

WinXPProSP2/Office 2003: I'm programming in MS Access VBA and need to call
a
WinAPI function. I'm new to coding API calls, so I don't yet understand
the
conventions very well.

My specific goal is to determine the number of pixels per physical inch of
screen -both horizontally and vertically - for use elsewhere in my
application. From what I can tell, the 'getdevicecaps' function provides
pixels-per-inch (PPI), but I don't know how to implement it in VBA. So
far,
I have the following code in a VBA module and would appreciate any advice
on
how to code the function arguments (and anything else necessary to get
this
to work properly):

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

Public Function GetHPixelsPerInch() As Long
'Get horizontal pixels per inch
pixH = GetDeviceCaps(I don't know what goes here)
GetHPixelsPerInch = pixH
End Function

Public Function GetVPixelsPerInch() As Long
'Get vertical pixels per inch
pixV = GetDeviceCaps(I don't know what goes here)
GetVPixelsPerInch = pixV
End Function

Sub screenPixPerInch()
MsgBox "X PPI = " & GetHPixelsPerInch & Chr(13) & _
"Y PPI = " & GetVPixelsPerInch
End Sub
-----------
Thanks,
Jay


  #4  
Old December 17th 08, 06:39 PM posted to microsoft.public.windowsxp.general
jay
external usenet poster
 
Posts: 168
Default API basics and getdevicecaps

Hi Kelly -

Sorry for the slow reply. Thank you for the scriptcenter resource.

Jay

"Kelly" wrote:

Start here, Jay.
http://www.microsoft.com/technet/scr...r/default.mspx

--

All the Best and Happy Turkey Day,
Kelly (MS-MVP/DTS&XP)

Taskbar Repair Tool Plus!
http://www.kellys-korner-xp.com/taskbarplus!.htm


"Jay" wrote in message
...
Hi -

WinXPProSP2/Office 2003: I'm programming in MS Access VBA and need to call
a
WinAPI function. I'm new to coding API calls, so I don't yet understand
the
conventions very well.

My specific goal is to determine the number of pixels per physical inch of
screen -both horizontally and vertically - for use elsewhere in my
application. From what I can tell, the 'getdevicecaps' function provides
pixels-per-inch (PPI), but I don't know how to implement it in VBA. So
far,
I have the following code in a VBA module and would appreciate any advice
on
how to code the function arguments (and anything else necessary to get
this
to work properly):

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

Public Function GetHPixelsPerInch() As Long
'Get horizontal pixels per inch
pixH = GetDeviceCaps(I don't know what goes here)
GetHPixelsPerInch = pixH
End Function

Public Function GetVPixelsPerInch() As Long
'Get vertical pixels per inch
pixV = GetDeviceCaps(I don't know what goes here)
GetVPixelsPerInch = pixV
End Function

Sub screenPixPerInch()
MsgBox "X PPI = " & GetHPixelsPerInch & Chr(13) & _
"Y PPI = " & GetVPixelsPerInch
End Sub
-----------
Thanks,
Jay



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off






All times are GMT +1. The time now is 04:02 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.