orbs Posted September 7, 2015 Share Posted September 7, 2015 (edited) Summaryfollowing this discussion in the GUI H&S forum:this UDF attempts to provide an easy fix for the issue in Windows 10 Snap feature, that wrongly resizes a window when dragged way off-screen.the issue is apparent for non-resizable windows, when the Snap feature is turned OFF. How To Teston a Windows 10 machine (also tested on a VM), disable the Snap feature (right-click the desktop > Display settings > Multitasking).download the UDF and the example into the same folder, and run the example. it will create 4 windows which you can drag around to see how they react (and a MsgBox you can confirm to close the example script):1. "Default" - drag this over the top of the screen (use the "drag" label) and see that it is being incorrectly resized.2. "SnapFix" - this window uses the UDF to demonstrate that the issue is resolved.3. "SnapFix_NoTitleBar" - this window demonstrates that the issue is resolved even for windows without a title bar4. "SnapFix_PopUp" - this window demonstrates that the $WS_POPUP style alone is NOT WORKING properly! must be combined with $WS_BORDER or $WS_THICKFRAME to work. How To Usefirst, the UDF needs to be included and initialized. add this at the top of your script:#include <SnapFix.au3> _SnapFix_Init()to enable the UDF for you GUI (multiple GUI's supported, not all your GUI's must be fixed), add this line after creating a GUI:_SnapFix($hGUI)where $hGUI is the GUI handle as returned by GUICreate() The UDF SnapFix.au3 SnapFix_Example.au3 What Nextas described above, $WS_POPUP alone is not working. an override is suggested, but perhaps a solution exists.the UDF sets some global conditions: it changes the default GUI resize mode, and registers the window message WM_SIZE, so if your script registers the WM_SIZE message for its own purposes, then in your registered function, you must call the internal UDF function __SnapFix_WM_SIZE(), like this:Func MY_WM_SIZE($hWnd, $iMsg, $wParam, $lParam) __SnapFix_WM_SIZE($hWnd, $iMsg, $wParam, $lParam) ; your original function contents here EndFunc ;==>MY_WM_SIZE the global conditions are not thoroughly tested, so use with caution! Edited September 7, 2015 by orbs coffeeturtle 1 Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
coffeeturtle Posted September 9, 2015 Share Posted September 9, 2015 Thank you @orbs for your work in putting this UDF together. I'm happy to hear about your workaround. Just a couple of questions:Will this have any effect on our GUI's under the previous versions of Windows?Will we need to code for first checking the OS Version before implementing a "snapfix"?Thank you. Link to comment Share on other sites More sharing options...
orbs Posted September 9, 2015 Author Share Posted September 9, 2015 (edited) this UDF has no apparent effect on Windows 7, as well as on Windows 10 with Snap set to ON. (well, more precisely, it mimics the expected behavior, which occurs anyways). the effect of this UDF is only apparent on Windows 10 with Snap set to OFF.not tested on the following versions of Windows:88.18.1 Update 18.1 Update 1 mark 18.1 Update 1 mark 1 RC18.1 Update 1 mark 1 RC1.18.1 Update 1 mark 1 RC1.1 HotFix 1...and the rest of the Windows 8 series. EDIT: reminder: do NOT "SnapFix" your GUI if it is resizable. only non-resizable GUI should use SnapFix. Edited September 9, 2015 by orbs Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now