Jump to content

GUIRegisterMsg and ArrayDisplay hangs


Recommended Posts

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

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

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

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

Dirty? Is it? Don't think so... I do this all the time :P, to have them available at (near) runtime call the results via a timer.

Link to comment
Share on other sites

Just because you do it all the time doesn't mean it is not dirty. :unsure:

Touchee :P, true most of the time :D, 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 !!!

Link to comment
Share on other sites

Dirty? Is it? Don't think so... I do this all the time :P, 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...