Jump to content

assign control to multiprocess - (Moved)


Recommended Posts

Posted (edited)

not enough information to answer. give us code that can be compiled and tested along with a CLEARLY defined process about what you are doing and why. Else don't expect much in the way of help.

 

and put the global definition of the control at the TOP of your script so it's defined before you call it from code.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to post
Share on other sites
Posted (edited)
33 minutes ago, joanex said:
 
... 
Func Thread _ sss ( $ iListview ) 
     _GUICtrlListView_SetItem ( $ iListview ,  "test" ,  0 ,  1 ) 
EndFunc 
Global  $ iListview  =  GUICtrlCreateListView ( "Column1 | Column2" ,  10 ,  10 ,  480 ,  250 ,  Mặc định ) 
...
 
>> Mã lỗi "biến được sử dụng mà không được khai báo"
_ CoProc _ Create ( 'Thread_sss' , $ iListview )

Cách gán quyền kiểm soát cho đa quy trình

 

My project

#include"CoProcEx.au3"
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListView.au3>

 Func Thread_sss($iLw1)
   _GUICtrlListView_SetItem($iLw1, "test", 0, 1)
EndFunc




Global Const $LVM_CHECKED = 8192, $LVM_UNCHECKED = 4096

Global $iLastItemChecked = -1, $blItemAdded = False

#region GUI
Local $hGUI = GUICreate("MyGUI", 500, 500)

Global $iLw1 = GUICtrlCreateListView("Column1|Column2", 10, 10, 480, 250, Default)


For $i = 0 To 9
    $blItemAdded = True
    GUICtrlCreateListViewItem("Item " & $i & "|" & "aaa" & $i, $iLw1)

Next
_GUICtrlListView_SetItemChecked($iLw1, 1)
$iLastItemChecked = 1

_GUICtrlListView_SetItem($iLw1, "thread", 0, 1)


;Thread_ss($iLw1)

GUISetState(@SW_SHOW, $hGUI)
#endregion GUI

Local $aText = 0

_CoProc_Create('Thread_ss',$iLw1)

Func a($a)
   MsgBox(0,0,$a)
EndFunc

;_CoProc_Create('Thread_', $iLw1, '1')
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop


    EndSwitch
    Sleep(10)
WEnd

GUIDelete($hGUI)


 Func Thread_ss($iLw1)
   _GUICtrlListView_SetItem($iLw1, "test", 0, 1)
 EndFunc

CoProcEx.au3 New AutoIt v3 Script.au3

Edited by Jos
Simply insert code in the post! ;)
Link to post
Share on other sites
  • Developers

Why would the new thread know anything about the GUI controls?
Doubt it does as it is a separate process, so you would have to use Controlxxx() functions like you would when automating a different program. \

Jos

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...