以前我曾做过这类程序.是用_StringEncrypt解决的这问题.
代码有些乱,你凑和着看看相关的部分吧.
;消息发送端
#Region AutoIt3Wrapper 预编译参数(常用参数)
#AutoIt3Wrapper_UseAnsi=N ;编码
#AutoIt3Wrapper_Icon= ;图标
#AutoIt3Wrapper_OutFile= ;输出文件名
#AutoIt3Wrapper_OutFile_Type=exe ;文件类型
#AutoIt3Wrapper_Compression=4 ;压缩等级
#AutoIt3Wrapper_UseUpx=y ;使用压缩
#AutoIt3Wrapper_Res_Comment= ;注释
#AutoIt3Wrapper_Res_Description= ;详细信息
#AutoIt3Wrapper_Res_Fileversion=0.1.0.0000 Alpha ;文件版本
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement= ;自动更新版本
#AutoIt3Wrapper_Res_LegalCopyright=eSoul ;版权
#AutoIt3Wrapper_Change2CUI=N ;修改输出的程序为CUI(控制台程序)
;#AutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer% ;自定义资源段
;#AutoIt3Wrapper_Run_Tidy= ;脚本整理
;#AutoIt3Wrapper_Run_Obfuscator= ;代码迷惑
;#AutoIt3Wrapper_Run_AU3Check= ;语法检查
;#AutoIt3Wrapper_Run_Before= ;运行前
;#AutoIt3Wrapper_Run_After= ;运行后
#EndRegion AutoIt3Wrapper 预编译参数设置完成
#cs ____________________________________
Au3 版本: AutoIt v3.3.6.1
软件语言: 简体中文
执行环境: WinXP
创建日期: 2010-07-18
修改日期:
脚本作者: eSoul
Email: Easied@QQ.com
QQ/TM: 19519549
脚本版本: 0.1.1.0718
脚本功能:
#ce _______________脚本开始_________________
#include <Date.au3>
#NoTrayIcon
FileChangeDir(@ScriptDir)
;==============================================
; 启动控制
;==============================================
fn_RepeatedStartControl("悄悄话检测系统-DrClient")
;==============================================
; 参数预设
;==============================================
$TargetIP = "192.168.0.127"
$nPort = 18666
$sComputerName = "DrClient" & StringRight(@ComputerName, 2)
$sPromptString = "有人联系您,请尽快回复!"
While 1
If fn_DrCheckIsCalled() = 1 Then
;==============================================
; 启动传输控制协议服务
;==============================================
TCPStartUp()
;==============================================
; 连接到监听 "套接字"
;==============================================
$ConnectedSocket = TCPConnect($TargetIP, $nPort)
If @error Then
MsgBox(4112, "差错", "TCPConnect 以 WSA 差错失败: " & @error)
Else
;==============================================
; 发送数据
;==============================================
$sPromptTime = StringRight("0000"&@YEAR, 4)&"-"&StringRight("00"&@MON, 2)&"-"&StringRight("00"&@MDAY, 2)&"|"&StringRight("00"&@HOUR, 2)&":"&StringRight("00"&@MIN, 2)&":"&StringRight("00"&@SEC, 2)
$sReturnString = $sComputerName &"|"& $sPromptTime &"|"& $sPromptString
$sReturnString = _StringEncrypt(1, $sReturnString, "123", 1)
$n = TCPSend($ConnectedSocket, $sReturnString)
;==============================================
; 关闭监听 "套接字"连接
;==============================================
TCPCloseSocket($ConnectedSocket)
Sleep(27*1000)
EndIf
EndIf
Sleep(3000)
WEnd
Exit
Func fn_DrCheckIsCalled()
$IsCalled = 0
For $i = 346 To 481 Step 15
If PixelGetColor(24, $i) = 3269425 Then
$IsCalled = 1
ExitLoop
EndIf
Next
Return($IsCalled)
EndFunc ;==>fn_DrCheckIsCalled
; #FUNCTION# ====================================================================================================================
; Name...........: _StringEncrypt
; Description ...: An RC4 based string encryption function.
; Syntax.........: _StringEncrypt($i_Encrypt, $s_EncryptText, $s_EncryptPassword[, $i_EncryptLevel = 1])
; Parameters ....: $i_Encrypt - 1 to encrypt, 0 to decrypt.
; $s_EncryptText - Text to encrypt/decrypt.
; $s_EncryptPassword - Password to encrypt/decrypt with.
; $i_EncryptLevel - Optional: Level to encrypt/decrypt. Default = 1
; $i_Flag - Optional: Changes how the string is stored as binary:
; flag = 1 (default), binary data is ANSI
; flag = 2, binary data is UTF16 Little Endian
; flag = 3, binary data is UTF16 Big Endian
; flag = 4, binary data is UTF8
; Return values .: Success - The Encrypted/Decrypted string.
; Failure - Blank string and @error = 1
; Author ........: Wes Wolfe-Wolvereness <Weswolf at aol dot com>
; Modified.......:
; Remarks .......: WARNING: This function has an extreme timespan if the encryption level or encrypted string are too large!
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _StringEncrypt($i_Encrypt, $s_EncryptText, $s_EncryptPassword, $i_EncryptLevel = 1, $i_Flag = 1)
If $i_Encrypt <> 0 And $i_Encrypt <> 1 Then
SetError(1)
Return ''
ElseIf $s_EncryptText = '' Or $s_EncryptPassword = '' Then
SetError(1)
Return ''
Else
If Number($i_EncryptLevel) <= 0 Or Int($i_EncryptLevel) <> $i_EncryptLevel Then $i_EncryptLevel = 1
Local $b_EncryptText
Local $b_EncryptPassword
Local $v_EncryptModified
Local $i_EncryptCountH
Local $i_EncryptCountG
Local $v_EncryptSwap
Local $av_EncryptBox[256][2]
Local $i_EncryptCountA
Local $i_EncryptCountB
Local $i_EncryptCountC
Local $i_EncryptCountD
Local $i_EncryptCountE
Local $v_EncryptCipher
Local $v_EncryptCipherBy
$b_EncryptText = StringToBinary($s_EncryptText, $i_Flag)
$b_EncryptPassword = StringToBinary($s_EncryptPassword, $i_Flag)
If $i_Encrypt = 1 Then
For $i_EncryptCountF = 0 To $i_EncryptLevel Step 1
$i_EncryptCountG = ''
$i_EncryptCountH = ''
$v_EncryptModified = Binary('')
For $i_EncryptCountG = 1 To BinaryLen($b_EncryptText)
If $i_EncryptCountH = BinaryLen($b_EncryptPassword) Then
$i_EncryptCountH = 1
Else
$i_EncryptCountH += 1
EndIf
$v_EncryptModified = Binary($v_EncryptModified) & Binary('0x' & Hex(BitXOR(BinaryMid($b_EncryptText, $i_EncryptCountG, 1), BinaryMid($b_EncryptPassword, $i_EncryptCountH, 1), 255),2))
Next
$b_EncryptText = $v_EncryptModified
$i_EncryptCountA = ''
$i_EncryptCountB = 0
$i_EncryptCountC = ''
$i_EncryptCountD = ''
$i_EncryptCountE = ''
$v_EncryptCipherBy = ''
$v_EncryptCipher = ''
$v_EncryptSwap = ''
$av_EncryptBox = ''
Local $av_EncryptBox[256][2]
For $i_EncryptCountA = 0 To 255
$av_EncryptBox[$i_EncryptCountA][1] = Dec(StringTrimLeft(BinaryMid($b_EncryptPassword, Mod($i_EncryptCountA, BinaryLen($b_EncryptPassword)) + 1, 1),2))
$av_EncryptBox[$i_EncryptCountA][0] = $i_EncryptCountA
Next
For $i_EncryptCountA = 0 To 255
$i_EncryptCountB = Mod(($i_EncryptCountB + $av_EncryptBox[$i_EncryptCountA][0] + $av_EncryptBox[$i_EncryptCountA][1]), 256)
$v_EncryptSwap = $av_EncryptBox[$i_EncryptCountA][0]
$av_EncryptBox[$i_EncryptCountA][0] = $av_EncryptBox[$i_EncryptCountB][0]
$av_EncryptBox[$i_EncryptCountB][0] = $v_EncryptSwap
Next
For $i_EncryptCountA = 1 To BinaryLen($b_EncryptText)
$i_EncryptCountC = Mod(($i_EncryptCountC + 1), 256)
$i_EncryptCountD = Mod(($i_EncryptCountD + $av_EncryptBox[$i_EncryptCountC][0]), 256)
$i_EncryptCountE = $av_EncryptBox[Mod(($av_EncryptBox[$i_EncryptCountC][0] + $av_EncryptBox[$i_EncryptCountD][0]), 256) ][0]
$v_EncryptCipherBy = BitXOR(BinaryMid($b_EncryptText, $i_EncryptCountA, 1), $i_EncryptCountE)
$v_EncryptCipher = Binary($v_EncryptCipher) & Binary('0x' & Hex($v_EncryptCipherBy, 2))
Next
$b_EncryptText = StringTrimLeft($v_EncryptCipher,2)
Next
Else
$b_EncryptText = $s_EncryptText
For $i_EncryptCountF = 0 To $i_EncryptLevel Step 1
$b_EncryptText = Binary('0x' & $b_EncryptText)
$i_EncryptCountB = 0
$i_EncryptCountC = ''
$i_EncryptCountD = ''
$i_EncryptCountE = ''
$v_EncryptCipherBy = ''
$v_EncryptCipher = ''
$v_EncryptSwap = ''
$av_EncryptBox = ''
Local $av_EncryptBox[256][2]
For $i_EncryptCountA = 0 To 255
$av_EncryptBox[$i_EncryptCountA][1] = Dec(StringTrimLeft(BinaryMid($b_EncryptPassword, Mod($i_EncryptCountA, BinaryLen($b_EncryptPassword)) + 1, 1),2))
$av_EncryptBox[$i_EncryptCountA][0] = $i_EncryptCountA
Next
For $i_EncryptCountA = 0 To 255
$i_EncryptCountB = Mod(($i_EncryptCountB + $av_EncryptBox[$i_EncryptCountA][0] + $av_EncryptBox[$i_EncryptCountA][1]), 256)
$v_EncryptSwap = $av_EncryptBox[$i_EncryptCountA][0]
$av_EncryptBox[$i_EncryptCountA][0] = $av_EncryptBox[$i_EncryptCountB][0]
$av_EncryptBox[$i_EncryptCountB][0] = $v_EncryptSwap
Next
For $i_EncryptCountA = 1 To BinaryLen($b_EncryptText)
$i_EncryptCountC = Mod(($i_EncryptCountC + 1), 256)
$i_EncryptCountD = Mod(($i_EncryptCountD + $av_EncryptBox[$i_EncryptCountC][0]), 256)
$i_EncryptCountE = $av_EncryptBox[Mod(($av_EncryptBox[$i_EncryptCountC][0] + $av_EncryptBox[$i_EncryptCountD][0]), 256) ][0]
$v_EncryptCipherBy = BitXOR(BinaryMid($b_EncryptText, $i_EncryptCountA, 1), $i_EncryptCountE)
$v_EncryptCipher = Binary($v_EncryptCipher) & Binary('0x' & Hex($v_EncryptCipherBy,2))
Next
$b_EncryptText = $v_EncryptCipher
$i_EncryptCountG = ''
$i_EncryptCountH = ''
$v_EncryptModified = ''
For $i_EncryptCountG = 1 To BinaryLen($b_EncryptText)
If $i_EncryptCountH = BinaryLen($b_EncryptPassword) Then
$i_EncryptCountH = 1
Else
$i_EncryptCountH += 1
EndIf
$v_EncryptModified = Binary($v_EncryptModified) & Binary('0x' & Hex(BitXOR(BinaryMid($b_EncryptText, $i_EncryptCountG, 1), BinaryMid($b_EncryptPassword, $i_EncryptCountH, 1), 255),2))
Next
$b_EncryptText = BinaryToString($v_EncryptModified, $i_Flag)
Next
EndIf
Return $b_EncryptText
EndIf
EndFunc ;==>_StringEncrypt
; ===============================================================================================================================
; 函数名称: fn_RepeatedStartControl
; 函数版本: 0.1.1.0718 Alpha
; 函数说明: 控制程序的多重启动
; 函数语法: fn_RepeatedStartControl($iMode, $sFinalTitle)
; 参数说明: $sFinalTitle -- 程序的最终标题
; $iMode -- 多重启动模式
; |0 - 允许本程序多重启动
; |1 - 禁止本程序重复执行
; |2 - 关闭重复的程序后,再继续执行本程序
; 返 回 值: 无返回值
; 函数作者: eSoul
; 创建日期: 2009-04-20
; 更新日期: 2010-07-18
; 函数改良:
; 修改说明:
; 相关函数:
; 链接网页:
; 函数示例:
; Example 1:
; $sFinalTitle = "多目录同步工具 v0.1.0.0420 Alpha"
; fn_RepeatedStartControl($sFinalTitle)
;
; Example 2:
; $sFinalTitle = "多目录同步工具 v0.1.0.0420 Alpha"
; $iMode = 2
; fn_RepeatedStartControl($sFinalTitle, $iMode)
; ===============================================================================================================================
Func fn_RepeatedStartControl($sFinalTitle, $iMode = 1)
;=================================================
; 定义局部变量
; $IsWindowExist -- 判断程序是否启动的变量
;=================================================
Local $IsWindowExist
;=================================================
; 若没检查到程序多重启动,则返回继续操作
;=================================================
$IsWindowExist = WinList($sFinalTitle)
If $IsWindowExist[0][0] = 0 Then
AutoItWinSetTitle($sFinalTitle)
Return
EndIf
Select
;=================================================
; 允许本程序重复执行
;=================================================
Case $iMode = 0
AutoItWinSetTitle($sFinalTitle)
Return
;=================================================
; 禁止本程序重复执行
;=================================================
Case $iMode = 1
MsgBox(262144+16, "警告", "程序已经在运行,请勿重复执行!" & @LF & "请点击确定退出")
Exit
;=================================================
; 关闭重复的程序后,再继续执行本程序
;=================================================
Case $iMode = 2
Do
WinClose($sFinalTitle)
$IsWindowExist = WinList($sFinalTitle)
Sleep(1000)
Until $IsWindowExist[0][0] = 0
AutoItWinSetTitle($sFinalTitle)
Return
EndSelect
EndFunc ;==>fn_RepeatedStartControl
;接收端
#Region AutoIt3Wrapper 预编译参数(常用参数)
#AutoIt3Wrapper_UseAnsi=N ;编码
#AutoIt3Wrapper_Icon= ;图标
#AutoIt3Wrapper_OutFile= ;输出文件名
#AutoIt3Wrapper_OutFile_Type=exe ;文件类型
#AutoIt3Wrapper_Compression=4 ;压缩等级
#AutoIt3Wrapper_UseUpx=y ;使用压缩
#AutoIt3Wrapper_Res_Comment= ;注释
#AutoIt3Wrapper_Res_Description= ;详细信息
#AutoIt3Wrapper_Res_Fileversion=0.1.0.0000 Alpha ;文件版本
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement= ;自动更新版本
#AutoIt3Wrapper_Res_LegalCopyright=eSoul ;版权
#AutoIt3Wrapper_Change2CUI=N ;修改输出的程序为CUI(控制台程序)
;#AutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer% ;自定义资源段
;#AutoIt3Wrapper_Run_Tidy= ;脚本整理
;#AutoIt3Wrapper_Run_Obfuscator= ;代码迷惑
;#AutoIt3Wrapper_Run_AU3Check= ;语法检查
;#AutoIt3Wrapper_Run_Before= ;运行前
;#AutoIt3Wrapper_Run_After= ;运行后
#EndRegion AutoIt3Wrapper 预编译参数设置完成
#cs ____________________________________
Au3 版本: AutoIt v3.3.6.1
软件语言: 简体中文
执行环境: WinXP
创建日期: 2010-07-18
修改日期:
脚本作者: eSoul
Email: Easied@QQ.com
QQ/TM: 19519549
脚本版本: 0.1.2.0719
脚本功能:
#ce _______________脚本开始_________________
#include <Date.au3>
#NoTrayIcon
FileChangeDir(@ScriptDir)
;==============================================
; 启动控制
;==============================================
If $CmdLine[0] > 0 Then
$IsWindowExist = WinList($CmdLine[1])
If $IsWindowExist[0][0] = 0 Then
MsgBox(4096, $CmdLine[1], $CmdLine[2] &@CRLF& $CmdLine[3] &@CRLF& $CmdLine[4])
Else
$sExistTexts = WinGetText($CmdLine[1], "")
$sExistTexts = StringRight($sExistTexts, StringLen($sExistTexts)-3)
$sExistTexts = StringLeft ($sExistTexts, StringLen($sExistTexts)-StringLen("有人联系您,请尽快回复!")-3)
If StringInStr($sExistTexts, $CmdLine[2]) Then
$sNewTexts = $sExistTexts &@CRLF& $CmdLine[3] &@CRLF& $CmdLine[4]
Else
$sNewTexts = $sExistTexts &@CRLF& $CmdLine[2] &@CRLF& $CmdLine[3] &@CRLF& $CmdLine[4]
EndIf
ControlClick($CmdLine[1], "有人联系您", "[CLASS:Button; INSTANCE:1]", "left", 2)
MsgBox(4096, $CmdLine[1], $sNewTexts)
EndIf
Exit
EndIf
fn_RepeatedStartControl("悄悄话检测系统-Console")
;==============================================
; 参数预设
;==============================================
$LocalIP = @IPAddress1
$nPort = 18666
;==============================================
; 启动传输控制协议服务
;==============================================
TCPStartUp()
;==============================================
; 建立监听 "套接字"
;==============================================
$MainSocket = TCPListen($LocalIP, $nPort, 100)
If $MainSocket = -1 Then
MsgBox(4096, "", "TCPListen失败,程序退出!")
Exit
EndIf
;==============================================
; 等待客户连接
;==============================================
While 1
$ConnectedSocket = TCPAccept($MainSocket)
If $ConnectedSocket >= 0 Then
While 1
$sRecv = TCPRecv($ConnectedSocket, 2048)
If @error Then ExitLoop
If $sRecv <> "" Then
$sPrompt = StringSplit(_StringEncrypt(0, $sRecv, "123", 1), "|")
Run(@ScriptFullPath &" "& $sPrompt[1] &"?Msg "& $sPrompt[2] &" "& $sPrompt[3] &" "& $sPrompt[4], @ScriptDir)
EndIf
WEnd
EndIf
Wend
Exit
Func fn_PromptBoX($sPrompt)
fn_RepeatedStartControl($sPrompt[1] & "的悄悄话提示")
MsgBox(4096, $sPrompt[1], $sPrompt[2] &@CRLF& $sPrompt[3] &@CRLF& $sPrompt[4])
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _StringEncrypt
; Description ...: An RC4 based string encryption function.
; Syntax.........: _StringEncrypt($i_Encrypt, $s_EncryptText, $s_EncryptPassword[, $i_EncryptLevel = 1])
; Parameters ....: $i_Encrypt - 1 to encrypt, 0 to decrypt.
; $s_EncryptText - Text to encrypt/decrypt.
; $s_EncryptPassword - Password to encrypt/decrypt with.
; $i_EncryptLevel - Optional: Level to encrypt/decrypt. Default = 1
; $i_Flag - Optional: Changes how the string is stored as binary:
; flag = 1 (default), binary data is ANSI
; flag = 2, binary data is UTF16 Little Endian
; flag = 3, binary data is UTF16 Big Endian
; flag = 4, binary data is UTF8
; Return values .: Success - The Encrypted/Decrypted string.
; Failure - Blank string and @error = 1
; Author ........: Wes Wolfe-Wolvereness <Weswolf at aol dot com>
; Modified.......:
; Remarks .......: WARNING: This function has an extreme timespan if the encryption level or encrypted string are too large!
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _StringEncrypt($i_Encrypt, $s_EncryptText, $s_EncryptPassword, $i_EncryptLevel = 1, $i_Flag = 1)
If $i_Encrypt <> 0 And $i_Encrypt <> 1 Then
SetError(1)
Return ''
ElseIf $s_EncryptText = '' Or $s_EncryptPassword = '' Then
SetError(1)
Return ''
Else
If Number($i_EncryptLevel) <= 0 Or Int($i_EncryptLevel) <> $i_EncryptLevel Then $i_EncryptLevel = 1
Local $b_EncryptText
Local $b_EncryptPassword
Local $v_EncryptModified
Local $i_EncryptCountH
Local $i_EncryptCountG
Local $v_EncryptSwap
Local $av_EncryptBox[256][2]
Local $i_EncryptCountA
Local $i_EncryptCountB
Local $i_EncryptCountC
Local $i_EncryptCountD
Local $i_EncryptCountE
Local $v_EncryptCipher
Local $v_EncryptCipherBy
$b_EncryptText = StringToBinary($s_EncryptText, $i_Flag)
$b_EncryptPassword = StringToBinary($s_EncryptPassword, $i_Flag)
If $i_Encrypt = 1 Then
For $i_EncryptCountF = 0 To $i_EncryptLevel Step 1
$i_EncryptCountG = ''
$i_EncryptCountH = ''
$v_EncryptModified = Binary('')
For $i_EncryptCountG = 1 To BinaryLen($b_EncryptText)
If $i_EncryptCountH = BinaryLen($b_EncryptPassword) Then
$i_EncryptCountH = 1
Else
$i_EncryptCountH += 1
EndIf
$v_EncryptModified = Binary($v_EncryptModified) & Binary('0x' & Hex(BitXOR(BinaryMid($b_EncryptText, $i_EncryptCountG, 1), BinaryMid($b_EncryptPassword, $i_EncryptCountH, 1), 255),2))
Next
$b_EncryptText = $v_EncryptModified
$i_EncryptCountA = ''
$i_EncryptCountB = 0
$i_EncryptCountC = ''
$i_EncryptCountD = ''
$i_EncryptCountE = ''
$v_EncryptCipherBy = ''
$v_EncryptCipher = ''
$v_EncryptSwap = ''
$av_EncryptBox = ''
Local $av_EncryptBox[256][2]
For $i_EncryptCountA = 0 To 255
$av_EncryptBox[$i_EncryptCountA][1] = Dec(StringTrimLeft(BinaryMid($b_EncryptPassword, Mod($i_EncryptCountA, BinaryLen($b_EncryptPassword)) + 1, 1),2))
$av_EncryptBox[$i_EncryptCountA][0] = $i_EncryptCountA
Next
For $i_EncryptCountA = 0 To 255
$i_EncryptCountB = Mod(($i_EncryptCountB + $av_EncryptBox[$i_EncryptCountA][0] + $av_EncryptBox[$i_EncryptCountA][1]), 256)
$v_EncryptSwap = $av_EncryptBox[$i_EncryptCountA][0]
$av_EncryptBox[$i_EncryptCountA][0] = $av_EncryptBox[$i_EncryptCountB][0]
$av_EncryptBox[$i_EncryptCountB][0] = $v_EncryptSwap
Next
For $i_EncryptCountA = 1 To BinaryLen($b_EncryptText)
$i_EncryptCountC = Mod(($i_EncryptCountC + 1), 256)
$i_EncryptCountD = Mod(($i_EncryptCountD + $av_EncryptBox[$i_EncryptCountC][0]), 256)
$i_EncryptCountE = $av_EncryptBox[Mod(($av_EncryptBox[$i_EncryptCountC][0] + $av_EncryptBox[$i_EncryptCountD][0]), 256) ][0]
$v_EncryptCipherBy = BitXOR(BinaryMid($b_EncryptText, $i_EncryptCountA, 1), $i_EncryptCountE)
$v_EncryptCipher = Binary($v_EncryptCipher) & Binary('0x' & Hex($v_EncryptCipherBy, 2))
Next
$b_EncryptText = StringTrimLeft($v_EncryptCipher,2)
Next
Else
$b_EncryptText = $s_EncryptText
For $i_EncryptCountF = 0 To $i_EncryptLevel Step 1
$b_EncryptText = Binary('0x' & $b_EncryptText)
$i_EncryptCountB = 0
$i_EncryptCountC = ''
$i_EncryptCountD = ''
$i_EncryptCountE = ''
$v_EncryptCipherBy = ''
$v_EncryptCipher = ''
$v_EncryptSwap = ''
$av_EncryptBox = ''
Local $av_EncryptBox[256][2]
For $i_EncryptCountA = 0 To 255
$av_EncryptBox[$i_EncryptCountA][1] = Dec(StringTrimLeft(BinaryMid($b_EncryptPassword, Mod($i_EncryptCountA, BinaryLen($b_EncryptPassword)) + 1, 1),2))
$av_EncryptBox[$i_EncryptCountA][0] = $i_EncryptCountA
Next
For $i_EncryptCountA = 0 To 255
$i_EncryptCountB = Mod(($i_EncryptCountB + $av_EncryptBox[$i_EncryptCountA][0] + $av_EncryptBox[$i_EncryptCountA][1]), 256)
$v_EncryptSwap = $av_EncryptBox[$i_EncryptCountA][0]
$av_EncryptBox[$i_EncryptCountA][0] = $av_EncryptBox[$i_EncryptCountB][0]
$av_EncryptBox[$i_EncryptCountB][0] = $v_EncryptSwap
Next
For $i_EncryptCountA = 1 To BinaryLen($b_EncryptText)
$i_EncryptCountC = Mod(($i_EncryptCountC + 1), 256)
$i_EncryptCountD = Mod(($i_EncryptCountD + $av_EncryptBox[$i_EncryptCountC][0]), 256)
$i_EncryptCountE = $av_EncryptBox[Mod(($av_EncryptBox[$i_EncryptCountC][0] + $av_EncryptBox[$i_EncryptCountD][0]), 256) ][0]
$v_EncryptCipherBy = BitXOR(BinaryMid($b_EncryptText, $i_EncryptCountA, 1), $i_EncryptCountE)
$v_EncryptCipher = Binary($v_EncryptCipher) & Binary('0x' & Hex($v_EncryptCipherBy,2))
Next
$b_EncryptText = $v_EncryptCipher
$i_EncryptCountG = ''
$i_EncryptCountH = ''
$v_EncryptModified = ''
For $i_EncryptCountG = 1 To BinaryLen($b_EncryptText)
If $i_EncryptCountH = BinaryLen($b_EncryptPassword) Then
$i_EncryptCountH = 1
Else
$i_EncryptCountH += 1
EndIf
$v_EncryptModified = Binary($v_EncryptModified) & Binary('0x' & Hex(BitXOR(BinaryMid($b_EncryptText, $i_EncryptCountG, 1), BinaryMid($b_EncryptPassword, $i_EncryptCountH, 1), 255),2))
Next
$b_EncryptText = BinaryToString($v_EncryptModified, $i_Flag)
Next
EndIf
Return $b_EncryptText
EndIf
EndFunc ;==>_StringEncrypt
; ===============================================================================================================================
; 函数名称: fn_RepeatedStartControl
; 函数版本: 0.1.1.0718 Alpha
; 函数说明: 控制程序的多重启动
; 函数语法: fn_RepeatedStartControl($iMode, $sFinalTitle)
; 参数说明: $sFinalTitle -- 程序的最终标题
; $iMode -- 多重启动模式
; |0 - 允许本程序多重启动
; |1 - 禁止本程序重复执行
; |2 - 关闭重复的程序后,再继续执行本程序
; 返 回 值: 无返回值
; 函数作者: eSoul
; 创建日期: 2009-04-20
; 更新日期: 2010-07-18
; 函数改良:
; 修改说明:
; 相关函数:
; 链接网页:
; 函数示例:
; Example 1:
; $sFinalTitle = "多目录同步工具 v0.1.0.0420 Alpha"
; fn_RepeatedStartControl($sFinalTitle)
;
; Example 2:
; $sFinalTitle = "多目录同步工具 v0.1.0.0420 Alpha"
; $iMode = 2
; fn_RepeatedStartControl($sFinalTitle, $iMode)
; ===============================================================================================================================
Func fn_RepeatedStartControl($sFinalTitle, $iMode = 1)
;=================================================
; 定义局部变量
; $IsWindowExist -- 判断程序是否启动的变量
;=================================================
Local $IsWindowExist
;=================================================
; 若没检查到程序多重启动,则返回继续操作
;=================================================
$IsWindowExist = WinList($sFinalTitle)
If $IsWindowExist[0][0] = 0 Then
AutoItWinSetTitle($sFinalTitle)
Return
EndIf
Select
;=================================================
; 允许本程序重复执行
;=================================================
Case $iMode = 0
AutoItWinSetTitle($sFinalTitle)
Return
;=================================================
; 禁止本程序重复执行
;=================================================
Case $iMode = 1
MsgBox(262144+16, "警告", "程序已经在运行,请勿重复执行!" & @LF & "请点击确定退出")
Exit
;=================================================
; 关闭重复的程序后,再继续执行本程序
;=================================================
Case $iMode = 2
Do
WinClose($sFinalTitle)
$IsWindowExist = WinList($sFinalTitle)
Sleep(1000)
Until $IsWindowExist[0][0] = 0
AutoItWinSetTitle($sFinalTitle)
Return
EndSelect
EndFunc ;==>fn_RepeatedStartControl
|