找回密码
 加入
搜索
楼主: kemyliu

[GUI管理] 【已解决】多进程子进程无法使用主进程的变量

 火.. [复制链接]
发表于 2012-2-6 14:29:59 | 显示全部楼层
本帖最后由 半芯竹 于 2012-2-6 14:35 编辑

回复 15# kemyliu


   
Case $Button1
                        _CoProc(test1(),$arry) 
                                                _CoProc(test2(),$arry)

你不也是这样调用的吗?为什么你还是这么嘴硬。。你第一次调用的,你自己看看吧。什么人嘛。。

你看你发的贴,1#
 _CoProc("test") 


如果按照你所说的,你所谓的方法
_CoProc("test1",$arry) 
                                                _CoProc("test2",$arry)

你看能运行吗??
 楼主| 发表于 2012-2-6 20:53:24 | 显示全部楼层
本帖最后由 kemyliu 于 2012-2-6 20:55 编辑

回复 16# 半芯竹
呵呵,不管怎样还是非常感谢你的热心帮助!
今天试了很多也认真看了_CoProc函数的介绍,现在终于搞定了,具体代码如下:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include "CoProc.au3"
#Region ### START Koda GUI section ### Form=
Global $Label1,$Label2,$arry[10]
$Form1 = GUICreate("Form1", 623, 444, 192, 124)
$Button1 = GUICtrlCreateButton("OK", 168, 248, 249, 73)
$Label1 = GUICtrlCreateLabel("This is for test 1!", 10, 60, 230, 81)
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$Label2 = GUICtrlCreateLabel("This is for test 2!", 350, 60, 230, 81)
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$Label3 = GUICtrlCreateLabel("This is for test 3!", 10, 150, 250, 81)
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$Label4 = GUICtrlCreateLabel("This is for test 4!", 350, 150, 250, 81)
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
 
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                         _CoProc("test1",$Label1&"|"&$Label2) 
                         _CoProc("test2",$Label3&"|"&$Label4)
        EndSwitch
WEnd
        
Func Test1($tt)
        Local $aa
        $aa=StringSplit($tt,"|")
        ControlSetText("Form1","",Number($aa[1]),"Hi,one change!")
        ControlSetText("Form1","",Number($aa[2]),"Hi,two change!")
        MsgBox(0,"message1",$tt)
EndFunc

      
Func Test2($ss)
        Local $bb
        $bb=StringSplit($ss,"|")
        ControlSetText("Form1","",Number($bb[1]),"Hi,third change!")
        ControlSetText("Form1","",Number($bb[2]),"Hi,four change!")
        MsgBox(0,"message2",$ss)
EndFunc
发表于 2012-3-1 00:22:09 | 显示全部楼层
无限膜拜中啊
发表于 2012-6-6 16:04:35 | 显示全部楼层
谢谢了.这也是我正在需要的.
发表于 2014-7-28 17:19:14 | 显示全部楼层
留脚印,以后用得到的
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-18 15:17 , Processed in 0.069014 second(s), 15 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表