Popular Post LarsJ Posted May 20, 2015 Popular Post Share Posted May 20, 2015 (edited) _ChooseColor in <Misc.au3> is based on ChooseColor function in comdlg32.dll. ChooseColor is depending on a CHOOSECOLOR structure. The Flags and lpfnHook fields in this structure can be used to create a hook function for the ChooseColor window. This hook function can be used to simulate a modeless ChooseColor window. There are two interesting features of a hook funtion. It allows you to receive windows messages even if the ChooseColor dialog is a modal window. And it makes it possible to determine which messages are to be forwarded to the ChooseColor dialog, and which are not to be forwarded.The hook function receives Windows messages before the ChooseColor dialog. If the hook function returns 0, the messages are forwarded to the ChooseColor dialog. If the hook function returns 1 (not 0), the messages are not forwarded to the ChooseColor dialog. Messages that are not forwarded to ChooseColor should be processed by the hook function.When the OK button in ChooseColor dialog is clicked, this click is handled by the hook function and not forwarded to the ChooseColor dialog. This means, that the ChooseColor window does not close. In the hook function the selected color is calculated and send to the AutoIt window with _SendMessage.In the zip below the main AutoIt GUI, ChooseColor.au3, contains a button. When you click this button another script, ModelessCC.au3, is started with ShellExecute. ModelessCC.au3 opens the ChooseColor dialog. There is no message loop in ModelessCC.au3. But because ChooseColor is modal, ModelessCC.au3 will not exit until ChooseColor is closed.The hook function is also running in ModelessCC.au3. The hook function is running even if ChooseColor is modal. The function catches the OK button clicks in ChooseColor and sends the color to the main AutoIt GUI with _SendMessage. The hook function and ChooseColorEx is coded in MiscEx.au3.The main AutoIt GUI contains 12 labels. Click a label, select a color in the ChooseColor dialog, click the OK button, and the background color of the label will be set to the selected color. You can select colors for all 12 labels without closing the ChooseColor dialog. Tested with AutoIt 3.3.10 on Windows 7 64 bit and Windows XP 32 bit.ModelessChooseColor.7z Edited May 22, 2015 by LarsJ UEZ, Norm73, argumentum and 2 others 4 1 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
UEZ Posted May 20, 2015 Share Posted May 20, 2015 Thanks for sharing! Nice demonstration Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
LarsJ Posted May 22, 2015 Author Share Posted May 22, 2015 UEZ, You are welcome.Thanks to all for likes and interest. Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions 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