... if (nPointSize) {
if (hDC = oSys.Call("user32::GetDC", hMainWnd)) {
nHeight = -oSys.Call("kernel32::MulDiv", nPointSize, oSys.Call("gdi32::GetDeviceCaps", hDC, 90 /*LOGPIXELSY*/ ), 72);
AkelPad.MemCopy(_PtrAdd(lpLogFontDst, 0) /*offsetof(LOGFONTW, lfHeight)*/ , nHeight, 3 /*DT_DWORD*/ );
oSys ...
Search found 45 matches: GetDeviceCaps
Searched query: +GetDeviceCaps
- Sun Aug 31, 2025 9:48 am
- Forum: Coding Questions
- Topic: How to create a menu from a ListBox
- Replies: 3
- Views: 932
- Tue Jul 16, 2024 7:40 pm
- Forum: Coding Questions
- Topic: MenuBar BackColor
- Replies: 22
- Views: 6283
Re: MenuBar BackColor
... CXSCREEN" : _SM_Name(SM_Pos,1)= "The width of the screen of the primary display monitor, in pixels. This is the same value obtained by calling GetDeviceCaps as follows: GetDeviceCaps( hdcPrimaryMonitor, HORZRES)." : SM_Pos+1
_SM_No(SM_Pos)= #SM_CXSIZE : _SM_Name(SM_Pos,0)= "SM_CXSIZE" : _SM_Name(SM ...
_SM_No(SM_Pos)= #SM_CXSIZE : _SM_Name(SM_Pos,0)= "SM_CXSIZE" : _SM_Name(SM ...
- Sun Jun 25, 2023 7:56 pm
- Forum: Coding Questions
- Topic: ButtonGadget modify color by CallBack [Resolved]
- Replies: 21
- Views: 4099
Re: ButtonGadget modify color by CallBack [Resolved]
When starting the program, calculate the DPI and add the coefficient where it is needed.
DesktopResolutionX()
GetDeviceCaps
DesktopResolutionX()
GetDeviceCaps
- Mon Jul 25, 2022 5:20 am
- Forum: Coding Questions
- Topic: Screen resolution and magnification factor
- Replies: 10
- Views: 1225
Re: Screen resolution and magnification factor
Code: Select all
Define hDC0 = GetWindowDC_(0)
Global scale.d = GetDeviceCaps_(hDC0, #LOGPIXELSY)/96
ReleaseDC_(0, hDC0)- Thu Aug 26, 2021 4:42 pm
- Forum: Coding Questions
- Topic: How do I get the SCALE directly from Windows?
- Replies: 17
- Views: 4432
Re: How do I get the SCALE directly from Windows?
This works for unaware:
https://docs.microsoft.com/en-us/window ... devicecaps
Code: Select all
int GetDeviceCaps(
HDC hdc,
int index
);
;with LOGPIXELSX and LOGPIXELSY
- Sat Aug 15, 2020 9:20 am
- Forum: Coding Questions
- Topic: Getting printer page margin widths
- Replies: 5
- Views: 1457
Re: Getting printer page margin widths
... since it came out but have run into a problem when compiling to 64-bit. My software prints to blank stick-on labels, both text and images, and precise location is needed. To do that I need to know the margins imposed by the printer. If I have the DC I can use GetDeviceCaps to work out the margins.
- Mon Mar 12, 2018 3:06 pm
- Forum: Tricks 'n' Tips
- Topic: How I make DPI-aware apps
- Replies: 50
- Views: 22810
Re: How I make DPI-aware apps
... this might not work properly on Windows 8.1+ where you can pick different DPI's in multimonitor environment. Since documentation for GetDeviceCaps() (which seems to be rather antique function) states the following:
LOGPIXELSX
Number of pixels per logical inch along the screen width. In a ...
LOGPIXELSX
Number of pixels per logical inch along the screen width. In a ...
- Tue Aug 08, 2017 1:14 am
- Forum: Coding Questions
- Topic: Win 8.1+ AND PB 5.40+: Fonts too small in DPI-aware progs
- Replies: 21
- Views: 10766
Re: Win 8.1+ AND PB 5.40+: Fonts too small in DPI-aware prog
... in EXEs, as DLLs inherit DPI from the calling process.
; This part is Windows 6.x+ only (Vista and newer) and must be done before using
; GetDeviceCaps().
user32 = OpenLibrary(#PB_Any, "user32.dll")
If user32
IsProcessDPIAware = GetFunction(user32, "IsProcessDPIAware")
If IsProcessDPIAware ...
; This part is Windows 6.x+ only (Vista and newer) and must be done before using
; GetDeviceCaps().
user32 = OpenLibrary(#PB_Any, "user32.dll")
If user32
IsProcessDPIAware = GetFunction(user32, "IsProcessDPIAware")
If IsProcessDPIAware ...
- Wed May 31, 2017 4:36 pm
- Forum: Coding Questions
- Topic: Win 8.1+ AND PB 5.40+: Fonts too small in DPI-aware progs
- Replies: 21
- Views: 10766
Re: [5.40 beta 8] Fonts too small in DPI-aware programs
... in EXEs, as DLLs inherit DPI from the calling process.
; This part is Windows 6.x+ only (Vista and newer) and must be done before using
; GetDeviceCaps().
user32 = OpenLibrary(#PB_Any, "user32.dll")
If user32
IsProcessDPIAware = GetFunction(user32, "IsProcessDPIAware")
If IsProcessDPIAware ...
; This part is Windows 6.x+ only (Vista and newer) and must be done before using
; GetDeviceCaps().
user32 = OpenLibrary(#PB_Any, "user32.dll")
If user32
IsProcessDPIAware = GetFunction(user32, "IsProcessDPIAware")
If IsProcessDPIAware ...
- Mon Sep 07, 2015 2:46 pm
- Forum: Coding Questions
- Topic: [Done] Print and print preview
- Replies: 25
- Views: 11095
Re: Print and print preview
To list paper sizes that the current printer can handle, on Windows you can use API GetDeviceCaps() and DeviceCapabilities().
PureBasicPower has PrinterLib for PB (free), it uses Windows API and the original source code can be downloaded:
PrinterLib
PureBasicPower has PrinterLib for PB (free), it uses Windows API and the original source code can be downloaded:
PrinterLib
- Thu Oct 30, 2014 5:56 pm
- Forum: Coding Questions
- Topic: Strange "Included" Fonts Behavior
- Replies: 9
- Views: 3278
Re: Strange "Included" Fonts Behavior
ExamineDesktops() is redundant in that code snippet. GetDeviceCaps/GetDC are pointed at the default Monitor '0'. Both of the 'Gets' are Windows API only, so if coding for other platforms too, infratec's snippet looks like a good solution. Good catch IdeasVacuum .
ExamineDesktops() was in the section ...
ExamineDesktops() was in the section ...
- Thu Oct 30, 2014 3:40 pm
- Forum: Coding Questions
- Topic: Strange "Included" Fonts Behavior
- Replies: 9
- Views: 3278
Re: Strange "Included" Fonts Behavior
ExamineDesktops() is redundant in that code snippet. GetDeviceCaps/GetDC are pointed at the default Monitor '0'. Both of the 'Gets' are Windows API only, so if coding for other platforms too, infratec's snippet looks like a good solution.
- Thu Oct 30, 2014 1:14 am
- Forum: Coding Questions
- Topic: Strange "Included" Fonts Behavior
- Replies: 9
- Views: 3278
Re: Strange "Included" Fonts Behavior
... know about the ExamineDesktops() functions, so this was a surprise revelation. But I have no info on the "what, where and how" of the related "GetDeviceCaps" and "GetDC" functions, along with the constant, #LOGPIXELSX. Where can I find details? In the PB Manual? Clearly, these functions return the ...
- Wed Oct 29, 2014 10:42 pm
- Forum: Coding Questions
- Topic: Strange "Included" Fonts Behavior
- Replies: 9
- Views: 3278
Re: Strange "Included" Fonts Behavior
... know about the ExamineDesktops() functions, so this was a surprise revelation. But I have no info on the "what, where and how" of the related "GetDeviceCaps" and "GetDC" functions, along with the constant, #LOGPIXELSX. Where can I find details? In the PB Manual? Clearly, these functions return the ...
- Tue Jan 07, 2014 1:07 am
- Forum: Applications - Feedback and Discussion
- Topic: PrinterLib 1.10
- Replies: 91
- Views: 61054
Re: PrinterLib 1.10
... the lib, Procedure ipprint_Font(), we see this:
;http://msdn.microsoft.com/library/en-us/gdi/fontext_4rw4.asp
font\lfHeight=(Height*ipprint_GetDeviceCaps(#LOGPIXELSY))/72
MS give a different method here, with reference to the LOGFONT structure
;http://msdn.microsoft.com/en-us/library/windows ...
;http://msdn.microsoft.com/library/en-us/gdi/fontext_4rw4.asp
font\lfHeight=(Height*ipprint_GetDeviceCaps(#LOGPIXELSY))/72
MS give a different method here, with reference to the LOGFONT structure
;http://msdn.microsoft.com/en-us/library/windows ...