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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|