mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-02 23:23:55 +00:00
parent
22fbae18dd
commit
ec82b0fd15
10
robotgo.go
10
robotgo.go
@ -1293,6 +1293,16 @@ ____ __ ____ __ .__ __. _______ ______ ____ __ ____
|
||||
|
||||
*/
|
||||
|
||||
// ScaleX get primary display horizontal DPI scale factor
|
||||
func ScaleX() int {
|
||||
return int(C.scalex())
|
||||
}
|
||||
|
||||
// ScaleY get primary display vertical DPI scale factor
|
||||
func ScaleY() int {
|
||||
return int(C.scaley())
|
||||
}
|
||||
|
||||
// ShowAlert show a alert window
|
||||
func ShowAlert(title, msg string, args ...string) int {
|
||||
var (
|
||||
|
@ -18,6 +18,27 @@ int show_alert(const char *title, const char *msg,
|
||||
return alert;
|
||||
}
|
||||
|
||||
intptr scalex(){
|
||||
#if defined(IS_WINDOWS)
|
||||
// Get desktop dc
|
||||
HDC desktopDc = GetDC(NULL);
|
||||
// Get native resolution
|
||||
intptr horizontalDPI = GetDeviceCaps(desktopDc, LOGPIXELSX);
|
||||
// intptr verticalDPI = GetDeviceCaps(desktopDc, LOGPIXELSY);
|
||||
return horizontalDPI;
|
||||
#endif
|
||||
}
|
||||
|
||||
intptr scaley(){
|
||||
#if defined(IS_WINDOWS)
|
||||
// Get desktop dc
|
||||
HDC desktopDc = GetDC(NULL);
|
||||
// Get native resolution
|
||||
intptr verticalDPI = GetDeviceCaps(desktopDc, LOGPIXELSY);
|
||||
return verticalDPI;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool is_valid(){
|
||||
bool abool = IsValid();
|
||||
return abool;
|
||||
|
Loading…
Reference in New Issue
Block a user