AutoHotkey Community

It is currently May 26th, 2012, 11:43 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 337 posts ]  Go to page Previous  1 ... 13, 14, 15, 16, 17, 18, 19 ... 23  Next
Author Message
 Post subject:
PostPosted: November 8th, 2009, 5:45 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
OK, I've confirmed the problem is to do with DPI Virtualisation, which requires Aero (also known as the DWM=Desktop Window Manager).
Quote:
Windows Vista introduces a feature called DPI virtualization which provides some level of automatic scaling support to applications which are not DPI aware. Without this feature, the size of the text and UI elements of DPI unaware applications would typically be smaller on high DPI settings compared to rest of the system, potentially causing usability and readability problems.

This feature works by providing “virtualized” system metrics and UI elements to the application, as if it were running at 96 DPI. The application then renders to a 96-DPI off-screen surface and the Desktop Windows Manager then scales the resulting application window to match the DPI setting. For example, if the DPI display setting is 144, DWM scales the application’s window by 150%, or 144/96. The type of scaling that DPI virtualization uses is based on pixel stretching. As a result, blurring occurs due to the stretched pixels. The following screenshot shows the type of visual artifact caused by stretched pixels due to DPI virtualization.

Source: http://go.microsoft.com/fwlink/?LinkID=129586

On Windows 7 64-bit with DWM and 150% DPI, I see an interesting problem: some applications work correctly with WindowPad, and some do not.

For instance, Explorer and Calc, which appear to be DPI-aware, end up squashed into a scaled down portion of the screen, whereas Foxit Reader, SpeedCrunch and Reshacker, which do not appear to be DPI-aware, work correctly. This makes sense: AutoHotkey gets the virtualised system metrics (monitor co-ords), then applies them to other applications where they are correct only if the application is not DPI-aware.

However, when I tested with 200%, some applications (including SpeedCrunch) were positioned off-screen and in inconsistent sizes/positions. I couldn't figure it out; maybe Windows got confused and needed a reboot (though I still haven't rebooted).

The solution might be to scale by the DPI setting for applications which are DPI-aware, but I need to know how to determine DPI-awareness.

Btw, VirtualBox does not look nice at 150% DPI... (it has rendering issues within its UI, and also scales the VM).


Edit: I've been getting very inconsistent results while testing.

For instance,
  • Though not ideal, I expect DPI-unaware applications to be positioned according to a rectangle like {0,0,A_ScreenWidth*dpi/96,A_ScreenHeight*dpi/96}; in other words, from the top-left of the screen to the bottom-right according to the "effective resolution" (which is lower with higher DPI settings). Sometimes it works this way, and sometimes they are instead positioned according to something more like {200,200,A_ScreenWidth,A_ScreenHeight}, which makes absolutely no sense.
  • MouseGetPos will inconsistently fail to detect the appropriate window (for the OutputVarWin arg).
  • My Mouse Gestures script was intermittently (i.e. at very close intervals) retrieving mouse co-ords in either DPI-scaled or DPI-unscaled co-ords (or perhaps scaled**2 vs scaled).
  • Worst of all, I can change DPI settings to and fro, and any of the above behaviour (with the same DPI settings) will change.
In Windows 7, if you choose "Set custom text size (DPI)", there is an option for "Use Windows XP style DPI scaling". I believe enabling this option disables DPI Virtualisation. I suggest you try this, and see how it affects the script and your applications. On my system it seems to fix the script and typically improve rendering in in various applications.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 9th, 2009, 6:16 am 
thanks.

I set the xp flag and this resolved the windowpad problem! thanks!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 10th, 2009, 12:12 am 
Hi again, Even though the XP flag solved the problem, I noticed the XP DPI mode doesn't really work that nice. I prefer the "new" DPI setting. However I understand that it seems to be to difficult to fix at the moment.


Report this post
Top
  
Reply with quote  
PostPosted: November 16th, 2009, 4:58 am 
how can i set one of the keys to ; (semicolon) in the WindowPad.ini file?

I want to use this key because it's real close to capslock in the Dvorak keyset.. luckily all of ',.aoe;qj work, except for semicolon.

for use in autohotkey w/o windowpad, see http://www.autohotkey.com/forum/topic6248.html


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 16th, 2009, 9:12 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
WindowPad uses the GetPrivateProfileSection function to read the hotkey sections from the INI file. This strips out lines which begin with ;. You can get around it by prepending a modifier to the hotkey, or using the virtual keycode (vk) or scan code (sc). I would suggest either the *wildcard or $usehook hotkey modifier. If you're using Capslock as a modifier key, the keyboard hook is probably already in use and there shouldn't be any downside of using $.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 16th, 2009, 2:32 pm 
thanks, that works on my winxp


Report this post
Top
  
Reply with quote  
PostPosted: November 18th, 2009, 7:28 am 
Offline

Joined: November 9th, 2009, 4:24 pm
Posts: 94
Im tried to move my demul window (dreamcast emulator)
and I made aan script with this code:

Code:
Run, C:\demul.exe
WindowPad.exe GatherWindows,1 "WindowPadMove, X, Y [, -5, +5, DEMUL ]"


but it doesn't work, where is the problem, im doint this as the configuration say.

Thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 18th, 2009, 10:37 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
Please read the "WindowPadMove" section of WindowPad.html, and note the following:
  • As in the AutoHotkey help file, [ brackets ] are used to denote optional parameters; i.e. parameters between [ and ] may be omitted, and the brackets themselves should not be used.
  • X and Y must be replaced with the appropriate value: -1, 0 or +1.
  • WidthFactor and HeightFactor, if specified, must be between 0.0 and 1.0.
  • WindowPad.exe is not a command. Use Run WindowPad.exe.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 18th, 2009, 3:13 pm 
Offline

Joined: November 9th, 2009, 4:24 pm
Posts: 94
Many thanks Lexikos, I modified my .ahk to this:

Code:
Run, C:\demul.exe
Run C:\WindowPad.exe GatherWindows,1 WindowPadMove, -1, -1, 0.5, 0.5, DEMUL


But it doesn't work, :shock:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 19th, 2009, 9:53 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
Why did you remove the quotation marks???
WindowPad.html wrote:
If a command's parameters contain spaces, the command and its arguments must be enclosed in quotation marks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2009, 11:37 pm 
Offline

Joined: November 22nd, 2009, 11:11 pm
Posts: 3
Lexikos, I've been noticing some weird stuff when I try to minimize MediaMonkey in my scripts. Basically it does not minimize correctly for me when I used WinMinimize, but with WindowPad, it works perfectly.

I noticed that in your windowpad code, you minimize a window using this command:
Code:
PostMessage, 0x112, 0xF020  ; WM_SYSCOMMAND, SC_MINIMIZE


When I changed that to WinMinimize, the same problem occurred using WindowPad to minimize the window. So something about your PostMessage is special. Obviously it works the best. Can you comment on why it's so good?

Thanks!

Note: Apparently one can't just replace WinMinimize with PostMessage...you need to get the window first...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 23rd, 2009, 8:59 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
"PostMessage, WM_SYSCOMMAND, SC_MINIMIZE" replicates what happens when you click the minimize button on the window or select Minimize from the window's system menu. The default handling of the message causes the window to be minimized (and also plays the system "minimize" sound), but each window may add its own handling for custom behaviour.

On the other hand, WinMinimize uses the Win32 API to directly minimize the window; it does something equivalent to this:
Code:
DllCall("ShowWindow", "uint", target_window_id, "int", SW_MINIMIZE:=0x6)

It is possible that MediaMonkey doesn't actually minimize when you click minimize; for instance, it could hide the window and create a tray icon. In that case, WinMinimize will bypass the custom behaviour and therefore won't be consistent with the PostMessage method.
Quote:
Apparently one can't just replace WinMinimize with PostMessage...you need to get the window first...
Actually, it is equally valid to omit the window title for WinMinimize in the same context; it will use the Last Found Window. Conversely, you can specify a window title with PostMessage, but you need a comma for each omitted parameter preceding it:
Code:
PostMessage, 0x112, 0xF020,,, WinTitle


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 23rd, 2009, 4:43 pm 
Offline

Joined: November 22nd, 2009, 11:11 pm
Posts: 3
Ah, right on, these music player apps seem to have an ability to minimize to a compact view. I had similar issue with iTunes.

So this would be the direct replacement for WinMimize,A
Code:
PostMessage, 0x112, 0xF020,,,A

Thanks so much for your help. I've been using Autohotkey & WindowPad for over a year, never fails. And each time I play with it, it just gets better. :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Thank you!
PostPosted: December 1st, 2009, 8:20 am 
Thank you guys, this is just what I need! :)


Report this post
Top
  
Reply with quote  
PostPosted: February 18th, 2010, 5:32 pm 
Offline

Joined: February 18th, 2010, 5:27 pm
Posts: 5
Thanks for this great script. Makes working with multiple windows on "older" PC (i.e. Vista) enjoyable.

But I found that WindowPad doesn't work for ONE specific Application Window. I am trying to figure out why. Any suggestions you have to help me debug this behavior would be most helpful.

If it helps then the Application Window is ScottradeElite (from www.scottrade.com).


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 337 posts ]  Go to page Previous  1 ... 13, 14, 15, 16, 17, 18, 19 ... 23  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: iDrug, IsNull, Miguel and 53 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group