mestre Posted October 16, 2006 Share Posted October 16, 2006 I'm having some trouble with this one if anyone wants to help. What I'm trying to do is show a window in the running process created with AutoItV3. The window shows but the buttons won't work. I've created a sample "Program" script which is the program running with the GUI and a "ShowWindow" script. When I use GuiSetState(@SW_SHOW) from inside the "Program" the Save and Cancel buttons work, and the check box in the list works. When I use WinSetState("$WindowName", "", @SW_SHOW) from "ShowWindow" program, the $WindowName from the running program shows like expected but, the Save and Cancel buttons don't work and the check box in the list does! Thanks in Advance. "Program" Script: expandcollapse popup#include <Guiconstants.au3> #include <guilistview.au3> $guiwindow = "Window1" $window = GUICreate($guiwindow, 620, 385) ; Create Buttons $BtnSave = GuiCtrlCreateButton("Save", 15, 330, 80, 40) $BtnCancel = GuiCtrlCreateButton("Cancel", 110, 330, 80, 40) ; Create Tray Opt("TrayMenuMode",1) $TrayOpen = TrayCreateItem("Open") $TrayExit = TrayCreateItem("Exit") TraySetState() ; Create ListView with CheckBoxes $listView1 = GuiCtrlCreateListView("Auto", 210, 10, 40, 365, $LVS_NOSORTHEADER, $LVS_EX_CHECKBOXES) _GUICtrlListViewSetColumnWidth($listview1,0,40) ; Put test checkbox in ListView GuiCtrlCreateListViewItem("", $listView1) while 1 $MSG = GUIGetMsg() $TrayMSG = TrayGetMsg() Select case $MSG = $BtnSave MsgBox("","Save","You clicked the save button") case $MSG = $BtnCancel MsgBox("","Cancel","You clicked the cancel button") Case $MSG = $GUI_EVENT_CLOSE GUISetState(@SW_HIDE) Case $TrayMSG = $TrayOpen GuiSetstate(@SW_SHOW) Case $TrayMSG = $TrayExit Exit EndSelect WEnd "ShowWindow" Script: WinSetState("Window1", "", @SW_SHOW) Link to comment Share on other sites More sharing options...
Uten Posted October 16, 2006 Share Posted October 16, 2006 Check out (or search for) GuiSwitch in the help file. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
Pakku Posted October 16, 2006 Share Posted October 16, 2006 (edited) i would like to use the guieventmode (help file) in my opinion way easier Edited November 16, 2010 by Pakku How can someone use Windows without using AutoIt?That one would properly don't know how to handle a computer!My scripts:Send files over internetKind of RSS reader3Draw ProUDF: convert a character string to a binary one and backCalculate PiCommand line downloader (Youtube/Google video)Set the transparency of a window just by hitting a key!Secure your pcOther things:My filemanMy profilePM me Link to comment Share on other sites More sharing options...
mestre Posted October 17, 2006 Author Share Posted October 17, 2006 Check out (or search for) GuiSwitch in the help file.I need to be able to show the window from an outside program. GuiSwitch works from within the program. Link to comment Share on other sites More sharing options...
mestre Posted October 17, 2006 Author Share Posted October 17, 2006 i would like to use the guieventmode (help file) in my opinion way easier Arjan Tried that too. GuiSetOnEvent "Program" Script: expandcollapse popup#include <Guiconstants.au3> #include <guilistview.au3> Opt("GUIOnEventMode", 1) $guiwindow = "Window1" $window = GUICreate($guiwindow, 620, 385) GUISetOnEvent($GUI_EVENT_CLOSE, "Hide") ; Create Buttons $BtnSave = GuiCtrlCreateButton("Save", 15, 330, 80, 40) GUICtrlSetOnEvent(-1, "BtnSave") $BtnCancel = GuiCtrlCreateButton("Cancel", 110, 330, 80, 40) GUICtrlSetOnEvent(-1, "BtnCancel") ; Create Tray Opt("TrayMenuMode",1) $TrayOpen = TrayCreateItem("Open") $TrayExit = TrayCreateItem("Exit") TraySetState() ; Create ListView with CheckBoxes $listView1 = GuiCtrlCreateListView("Auto", 210, 10, 40, 365, $LVS_NOSORTHEADER, $LVS_EX_CHECKBOXES) _GUICtrlListViewSetColumnWidth($listview1,0,40) ; Put test checkbox in ListView GuiCtrlCreateListViewItem("", $listView1) while 1 $TrayMSG = TrayGetMsg() Select Case $TrayMSG = $TrayOpen GuiSetstate(@SW_SHOW) Case $TrayMSG = $TrayExit Exit EndSelect WEnd Func BtnSave() MsgBox("","Save","You clicked the save button") EndFunc Func BtnCancel() MsgBox("","Cancel","You clicked the cancel button") EndFunc Func Hide() GUISetState(@SW_HIDE) EndFunc "ShowWindow" Script: CODEWinSetState("Window1", "", @SW_SHOW) Link to comment Share on other sites More sharing options...
Uten Posted October 17, 2006 Share Posted October 17, 2006 I guess I did not read your post wery well. But then again I don't think there is really good corespondence between your topic title and the problems you describe in your first post. To get the created controls to show you have to use GuiSetState(...) as the last line when you have finished creating the GUI. ; Put test checkbox in ListView GuiCtrlCreateListViewItem("", $listView1) GuiSetState() If you want to launche a window (as in a program) you will have to use Run(<pahtname to app>) and then get a handel to the window through one of the Win* Functions ( WinActive("") ) . Considering thatyou missed the GuiSetState function in your sample I think you will benefit from doing some searching and try out solutions allready provided in the forum. Wish you the best of luck and happy scripting. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling 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