Code: Alles auswählen
oPS := XbpPresSpace():New():Create( AppDesktop():WinDevice(), {100,100}, GRA_PU_LOENGLISH)
aTmp:= oPS:SetViewport()
oPS:Destroy()
nLogPix1 := aTmp[3]-aTmp[1]
Moderator: Moderatoren
Code: Alles auswählen
oPS := XbpPresSpace():New():Create( AppDesktop():WinDevice(), {100,100}, GRA_PU_LOENGLISH)
aTmp:= oPS:SetViewport()
oPS:Destroy()
nLogPix1 := aTmp[3]-aTmp[1]
Code: Alles auswählen
#define HORZRES 0x0008
#define VERTRES 0x000A
#define LOGPIXELSX 0x0058
#define LOGPIXELSY 0x005A
#define DESKTOPVERTRES 0x0075
#define DESKTOPHORZRES 0x0076
LOCAL aSize := AppDeskTop():CurrentSize()
LOCAL hDC := @user32:GetDC( HWND_DESKTOP )
LOCAL nXLogPixel := @Gdi32:GetDeviceCaps( hDC, LOGPIXELSX )
LOCAL nYLogPixel := @Gdi32:GetDeviceCaps( hDC, LOGPIXELSY )
LOCAL nVERTRES := @Gdi32:GetDeviceCaps( hDC, VERTRES )
LOCAL nHORZRES := @Gdi32:GetDeviceCaps( hDC, HORZRES )
LOCAL nDHORZRES := @Gdi32:GetDeviceCaps( hDC, DESKTOPHORZRES ) // native Monitor Size !
LOCAL nDVERTRES := @Gdi32:GetDeviceCaps( hDC, DESKTOPVERTRES ) // native Monitor Size !
@user32:ReleaseDC( HWND_DESKTOP,hDC)
Funktioniert so ab Windows 8, unter Windows 7 funktioniert das dummerweise so nicht - da funktioniert dafür die "alte" dpi-Berechnung.
es sind ja 6 Aufrufe also auch die DPI Werte vorhanden damit es auch unter XP funktioniert.
sorry, hier aus der WinUser.ch
Code: Alles auswählen
#define HWND_DESKTOP 0
der Code von Till ist aus Isernhagen 2014 und setzt eine Manifest mit DPIAWARE voraus.
versuche es doch mal selbst mit dem Code von Till Isernhagen 2014.