Jump to content

Program Hangup by using GUIRegisterMsg


Recommended Posts

Hello.

I'm working on a bigger network project written in au3 with much datatransfers and security stuff bla, thats the reason why i'm not posting the script here. (passwords, etc.)

If i remove that this script wouldn't make sense und it wouldn't work so i try to describe my problem.

The Userinterface is controlled in Eventmode (GUIOnEventMode 1) and additional by an adlib function.

Func _Runtime()
        Global $GUI_Handle
        $GUI_Msg = GUIGetMsg(0)
        Select
            Case $GUI_Msg = $GUI_EVENT_CLOSE
                _GUI_Close()            
        EndSelect
        
        $aCursorInfo = GUIGetCursorInfo($GUI_Handle)
        
        #region movingwindow
        ;[... not the problem ...]
        #endregion movingwindow
        If IsArray($aCursorInfo) Then
        #region buttons
            Global $GUI_Btn_Close, $GUI_Btn_Addons
            If _Runtime_Button($GUI_Btn_Close, $aCursorInfo) Then
                _GUI_Close()
            ElseIf _Runtime_Button($GUI_Btn_Addons, $aCursorInfo) Then
                _GUI_AddOns()
            EndIf
        #endregion buttons
        EndIf
    EndFunc

_Runtime_Button is an extra buttonruntime for graphical buttons. It creates some graphical effects and returns whether the button was pressed this time or not.

But thats also not the problem.

_GUI_AddOns creates a new modal gui, where you can do some settings. And there is the problem. By opening this gui and its runtimeroutine (GUIOnEventMode 0) the program sometimes - not always / seems like random - breaks down and i have to stop it by task manager.

I've tested and researched for that problem many hours.

It only occurs if i use GUIRegisterMsg (for the whole ui) and GUIGetCursorInfo (in buttonruntime) together. If one of that isn't used everything works fine.

If i only use GUIGetCursorInfo it works. If i only use GUIRegisterMsg it works. But i need both to realise some features.

I think it is an autoit internal problem because, i absolutly don't know why it happens and because this problem occurs not regular but rather randomly.

P.S: Please don't kill me for my english ^^

Thank you for helping

Nemcija

Attachment: How the result looks like

post-7467-1217291403_thumb.jpg

[url=www.vergessene-welt.de][/url]

Link to comment
Share on other sites

this is there because there is an other programpart where it is used :P

with GUIOnEventMode 0

i know it isn't good to mix that up but at least it works in that way (less code)

[url=www.vergessene-welt.de][/url]

Link to comment
Share on other sites

I still think your problems are coming from the mix of GUIOnEventMode 1 and GUIGetMsg(0).

The script is one or the other not both in the one script.

Without seeing the rest of your code I think you'll be tackling this problem alone for the moment.

Best of luck cheers.

Link to comment
Share on other sites

Even without it, this "error" occurs.

edit:

Now I've rewritten all parts with GUIGetMsg and replaced it by GUICtrlSetOnEvent(-1,"GUIa_Btn*")

It also works but this error occurs also randomly in that way i've discribed it.

Edited by Nemcija

[url=www.vergessene-welt.de][/url]

Link to comment
Share on other sites

sorry the full code is about some thousand lines with passwords and more :P

But sorry i try to show you what you need:

Global $GUIa_Active = 0
    Global $GUIa_List_Server
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
    Func _GUI_AddOns()
        AdlibDisable()
        Global $TMPa_AddonListe
        Global $CFG_TempDir,$CFG_MaxTries, $VAR_AviableAddonsB, $CFG_IniFile
        Global $GUIa_Handle,$GUI_Handle, $GUIa_Active, $GUIa_Btn_Close, $GUIa_List_Server, $GUIa_List_Client
        $GUIa_Title = "AddOns"
        $GUIa_Width = 655
        $GUIa_Height = 325
        $GUIa_Active = 1
        $GUIa_Handle = GUICreate($GUIa_Title,$GUIa_Width,$GUIa_Height)
            $GUIa_Label_va = GUICtrlCreateGroup("Verfügbare Addons",5,5,300,288)
                $GUIa_List_Server = GUICtrlCreateCombo("Lade Liste ...", 15, 25, 280, 270, BitOR($CBS_SIMPLE, $CBS_DISABLENOSCROLL, $WS_VSCROLL))
                    GUICtrlSetState(-1,$GUI_DISABLE)
            GUICtrlCreateGroup("",-99,-99,1,1)
            
            $GUIa_Btn_Add = GUICtrlCreateButton("+",312,25,30,30)
                GUICtrlSetState(-1,$GUI_DISABLE)
                GUICtrlSetFont(-1,16,1000)
                GUICtrlSetColor(-1,0x00ff00)
                GUICtrlSetOnEvent(-1,"GUIa_BtnAdd")
                
            $GUIa_Btn_Remove = GUICtrlCreateButton("-",312,60,30,30)
                GUICtrlSetState(-1,$GUI_DISABLE)
                GUICtrlSetFont(-1,16,1000)
                GUICtrlSetColor(-1,0xff0000)
                GUICtrlSetOnEvent(-1,"GUIa_BtnRemove")
                
            $GUIa_Label_va = GUICtrlCreateGroup("Ausgewählte Addons",350,5,300,288)
                $GUIa_List_Client = GUICtrlCreateList("", 360, 25, 280, 265)
                    GUICtrlSetState(-1,$GUI_DISABLE)
            GUICtrlCreateGroup("",-99,-99,1,1)
        
            $GUIa_Btn_Close = GUICtrlCreateButton("Schließen",$GUIa_Width-105,$GUIa_Height-25,100,20)
                GUICtrlSetOnEvent(-1,"GUIa_Close")
        GUISetState(@SW_SHOW,$GUIa_Handle)
;~      ;<Get list>
            ;[... Transfer bla bla ...]
;~      ;</Get list>
        If $GUIa_Active = 1 Then
            _GUIa_GetServerList()
            _GUIa_GetClientList()       
            
            GUICtrlSetState($GUIa_List_Server,$GUI_ENABLE)
            GUICtrlSetState($GUIa_List_Client,$GUI_ENABLE)
            GUICtrlSetState($GUIa_Btn_Add,$GUI_ENABLE)
            GUICtrlSetState($GUIa_Btn_Remove,$GUI_ENABLE)
        EndIf

        While $GUIa_Active = 1
            If WinActive($GUI_Handle) Then WinActivate($GUIa_Handle)
            Sleep(100)
        WEnd
        GUIDelete($GUIa_Handle)
        AdlibEnable("_Runtime",50)
    EndFunc


    Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
        Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo
        If Not IsHWnd($GUIa_List_Server) Then $hWndCombo = GUICtrlGetHandle($GUIa_List_Server)
        $hWndFrom = $ilParam
        $iIDFrom = BitAND($iwParam, 0xFFFF)
        $iCode = BitShift($iwParam, 16)
        Switch $hWndFrom
            Case $GUIa_List_Server, $hWndCombo
                Switch $iCode
                    Case $CBN_EDITCHANGE
                        _GUICtrlComboBox_AutoComplete($GUIa_List_Server)
                EndSwitch
        EndSwitch
        Return $GUI_RUNDEFMSG
    EndFunc

I hope it helps you understanding the problem.

Thank you

Edited by Nemcija

[url=www.vergessene-welt.de][/url]

Link to comment
Share on other sites

Uhm... maybe i should try it in an other way.

is there any possibility to replace that what i'm doing by GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") by something similar?

Nemcija

[url=www.vergessene-welt.de][/url]

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...