fps Posted December 25, 2005 Share Posted December 25, 2005 Hello all, I`ve got a little problem with 2 windows and a ListView. After the creation of a mainwindow, I want to create a second window with a ListView. If I click on a Column header the function Test() shall be called. But if I do so, I get a Windows Error(something like "could not write data to memory"). Here is my Script: #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) $main = GUICreate("Mainwindow", 420, 250, 100, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE_List") GUISetState(@SW_SHOW) Global $listview Create_LogList() While 1 Sleep(1000) WEnd Func Create_LogList() $list = GUICreate("Log Files", 220, 250, 100, 200,-1,$WS_EX_ACCEPTFILES) $listview = GUICtrlCreateListView ("col1|col2", 10, 10, 200, 150) $button = GUICtrlCreateButton ("View Log", 75, 170, 70, 20) $item1 = GUICtrlCreateListViewItem("Job1|OK",$listview) $item2 = GUICtrlCreateListViewItem("Job2|OK",$listview) GUICtrlSetState(-1, $GUI_ACCEPTFILES) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE_List") GUICtrlSetOnEvent($listview, "Test") EndFunc Func Test() MsgBox(0,"listview", "clicked="& GUICtrlGetState($listview),2) EndFunc Func CLOSE_List() Exit EndFunc The strange thing is, if I put the part of the mainwindow(line 4-6) directly above While 1, I don't get this error. Thanks for your help! Link to comment Share on other sites More sharing options...
Zedna Posted December 26, 2005 Share Posted December 26, 2005 You call GUISetOnEvent twice. In GUISetOnEvent try add last parameter winhandle to diferentiate window or in CLOSE_List Func handle window by @GUI_WINHANDLE $main = GUICreate("Mainwindow", 420, 250, 100, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE_List") $list = GUICreate("Log Files", 220, 250, 100, 200,-1,$WS_EX_ACCEPTFILES) ... GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE_List") Look into HelpFile at example for this function ... Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
fps Posted December 26, 2005 Author Share Posted December 26, 2005 (edited) Thanks for your reply! Unfortunately it didn't solve the problem. It doesn't matter if i take @GUI_WINHANDLE into account or not, it only depends on which GUI was created first. If $main is created after $list everything is fine, otherwise i get this windows crash. Edit: Just noticed that with the latest beta the bug is gone Edited December 26, 2005 by fps 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