mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 06:33:56 +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;
|
||||
@ -68,7 +89,7 @@ void set_active(const MData win){
|
||||
DWORD dwProcessId = 0;
|
||||
GetWindowThreadProcessId(hWnd, &dwProcessId);
|
||||
|
||||
if(dwProcessId == pInfo->dwPid) {
|
||||
if (dwProcessId == pInfo->dwPid) {
|
||||
pInfo->hWnd = hWnd;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -560,7 +560,7 @@ bool IsMaximized(void){
|
||||
|
||||
void SetActive(const MData win){
|
||||
// Check if the window is valid
|
||||
if (!IsValid()) {return;}
|
||||
if (!IsValid()) { return; }
|
||||
#if defined(IS_MACOSX)
|
||||
|
||||
// Attempt to raise the specified window object
|
||||
|
Loading…
Reference in New Issue
Block a user