Sascha Posted March 20, 2009 Share Posted March 20, 2009 Hello together, the following code hangs when calling the ArrayDisplay function. Any ideas why? CODE#include <Array.au3> #include "constants.au3" #include <GUIConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Protokollchecker", 277, 76, 390, 283, -1, BitOR($WS_EX_ACCEPTFILES,$WS_EX_WINDOWEDGE)) $btnOpenProt = GUICtrlCreateButton("Protokoll öffnen", 168, 24, 91, 25, 0) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "On_WM_ButtonCheckProt") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func On_WM_ButtonCheckProt($hWnd, $Msg, $wParam, $lParam) $nID = BitAND($wParam, 0x0000FFFF) if $nID = $btnOpenProt Then Local $array[10] $array[1] = "A" _ArrayDisplay($array) EndIf EndFunc Func On_WM_DragAndDrop($hWnd, $Msg, $wParam, $lParam) EndFunc Regards Sascha Link to comment Share on other sites More sharing options...
foster74 Posted March 20, 2009 Share Posted March 20, 2009 From help file: "Warning: blocking of running user functions which executes window messages with commands such as "Msgbox()" can lead to unexpected behavior, the return to the system should be as fast as possible !!!" If GUIRegisterMsg() is not needed, maybe look at OnEventMode? Or if needed, have the _ArrayDisplay outside of the function. Link to comment Share on other sites More sharing options...
Sascha Posted March 20, 2009 Author Share Posted March 20, 2009 From help file: return to the system should be as fast as possible !!!"Thank you.The only quick way to go around this was to set boolean flag in the the message function.I now call my method from within the message loop if the flags are set. My solution seems a little bit dirty to me but works Link to comment Share on other sites More sharing options...
jvanegmond Posted March 20, 2009 Share Posted March 20, 2009 You can also copy the function _ArrayDisplay from Array.au3 include and modify it to be a non-blocking function. github.com/jvanegmond Link to comment Share on other sites More sharing options...
KaFu Posted March 20, 2009 Share Posted March 20, 2009 The only quick way to go around this was to set boolean flag in the the message function.I now call my method from within the message loop if the flags are set. My solution seems a little bit dirty to me but worksDirty? Is it? Don't think so... I do this all the time , to have them available at (near) runtime call the results via a timer. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
jvanegmond Posted March 20, 2009 Share Posted March 20, 2009 Dirty? Is it? Don't think so... I do this all the time , to have them available at (near) runtime call the results via a timer.Just because you do it all the time doesn't mean it is not dirty. github.com/jvanegmond Link to comment Share on other sites More sharing options...
KaFu Posted March 20, 2009 Share Posted March 20, 2009 Just because you do it all the time doesn't mean it is not dirty. Touchee , true most of the time , but in my eyes thats how WMs should be treated. Check state, set vars and do the work at another point in your script. Can't see anything dirty about the usage of Global booleans to do this.The return to the system should be as fast as possible !!! OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
jvanegmond Posted March 20, 2009 Share Posted March 20, 2009 Touchee , true most of the time , but in my eyes thats how WMs should be treated. Check state, set vars and do the work at another point in your script. Can't see anything dirty about the usage of Global booleans to do this.Yes, I agree. It would be nice here to have some object oriented syntax, but whatever. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Sascha Posted March 20, 2009 Author Share Posted March 20, 2009 Dirty? Is it? Don't think so... I do this all the time , to have them available at (near) runtime call the results via a timer.In a multithreaded C++ application the use boolean flags as semaphores will (can) lead to chaos. Thats why i thinks it is not so clean. 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