找回密码
 加入
搜索
查看: 3242|回复: 4

[效率算法] ★★自动监控程序1输入框内容并同步至程序2输入框★★

[复制链接]
发表于 2010-9-29 15:46:41 | 显示全部楼层 |阅读模式
本帖最后由 zhenglei 于 2010-9-29 15:47 编辑

[/code]

★★自动监控程序1输入框内容并同步至程序2输入框★★
程序1 为全屏程序   大家可以吧程序1  先转成EXE运行

随后 程序2 是置顶的  程序2 开始监控程序1的输入框内容  如果空则不同步  如果程序1有输入 则程序2自动将监控到的数据读取到自身输入框中   
                     当程序2在INPUT1中按下回车后 则弹出读取到程序1的数据。。。。。。    就这几个功能  不知道兄弟们有没办法实现!!



研究很久没成功。 不知有没高手能搞定  。。谢谢。。。。。   代码如下:
#include <EditConstants.au3>   l;;;;;;;;;;;程序1 内容   被监控端
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("程序1---全屏的", @DesktopWidth,@DesktopHeight)
$Label1 = GUICtrlCreateLabel("程序1", 32, 16, 34, 17)
$Input1 = GUICtrlCreateInput("88888", 96, 136, 345, 80, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER))

GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUICtrlSetFont(-1, 50, 400, 0, "黑体")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd
#include <ButtonConstants.au3>;;;;;;;;;;;;;;;;程序2  监控程序1输入框的   
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("程序2", 423, 188)
$Input1 = GUICtrlCreateInput("等待获取程序1输入框的信息", 48, 32, 313, 21)

$Input2 = GUICtrlCreateInput("", 48, 80, 313, 21)
$Button1 = GUICtrlCreateButton("Button1", 120, 120, 113, 41)
$Button2 = GUICtrlCreateButton("Button1", 248, 120, 113, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

WinSetOnTop($Form1, "", 1)
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2010-9-29 15:48:08 | 显示全部楼层
自己先顶一下。。。。。
发表于 2010-9-29 16:09:21 | 显示全部楼层
在WHILE循环中加入读取程序1的那个EDIT框的的代码就可以了啊。
发表于 2010-9-29 16:21:51 | 显示全部楼层
本帖最后由 landays 于 2010-9-29 16:23 编辑

#include <ButtonConstants.au3>;;;;;;;;;;;;;;;;程序2  监控程序1输入框的
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("程序2", 423, 188)
$Input1 = GUICtrlCreateInput("等待获取程序1输入框的信息", 48, 32, 313, 21)

$Input2 = GUICtrlCreateInput("", 48, 80, 313, 21)
$Button1 = GUICtrlCreateButton("Button1", 120, 120, 113, 41)
$Button2 = GUICtrlCreateButton("Button1", 248, 120, 113, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

WinSetOnTop($Form1, "", 1)
While 1
        $Text = ControlGetText("程序1---全屏的", "", "Edit1")
        If $Text = "" Then
                GUICtrlSetData($Input2, "")
        Else
                GUICtrlSetData($Input2, $Text)
        EndIf
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                                Case $Button
Msgbox (0,0,GuictrlRead($Input2))
        EndSwitch
WEnd

评分

参与人数 1金钱 +30 收起 理由
zps26 + 30

查看全部评分

发表于 2010-9-30 07:35:11 | 显示全部楼层
数据传递部分,你可以参考一下此贴:
http://www.autoitx.com/thread-18488-1-1.html


其实不管 程序1 的 input 为不为空,都应该考虑传递的,譬如按下"删除键"。

检测 input 更改的话,可以使用WM_COMMAND中的$EN_CHANGE消息。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-16 03:50 , Processed in 0.088150 second(s), 28 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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