guinness

[SOLVED] WM_COPYDATA & x64 Issue

10 posts in this topic

#1 ·  Posted (edited)

I tidied the code from a post made by KaFu. The code is fully working in both x32 & x64. I also used _CmdLineRaw() to parse $CmdLineRaw to an Array.

Function: Version 11 (20/07/2014)

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7

#include <GUIConstantsEx.au3>
#include <WinAPISys.au3>
#include <WindowsConstants.au3>

Global Const $tagCOPYDATASTRUCT = 'ulong_ptr dwData;' & _
        'dword cbData;' & _
        'ptr lpData'
Global $IPC_GUID = 'E23D443E-F0E1-11E3-9E5C-90580B9E45A7'
Global Enum $IPC_AUTOITID, _
        $IPC_CLIENTWND, $IPC_CLIENTID, _
        $IPC_GLOBALID, _
        $IPC_ID, $IPC_ISMONITORING, _
        $IPC_MONITORID, _
        $IPC_SERVERWND, $IPC_SERVERID, _
        $IPC_MAX
Global Enum $IPC_CONTROLID, _
        $IPC_RECEIVEDDATA, $IPC_RECEIVEDWND, $IPC_RECEIVEDMSG, _
        $IPC__MAX
Global $IPC[$IPC__MAX] ; Internal array for the interprocess communication functions.
$IPC[$IPC_CONTROLID] = 0

#Region Example
; Display only if compiled.
If @Compiled Then
    Example()
Else
    MsgBox($MB_SYSTEMMODAL, '', 'Please compile the example before running.')
EndIf

Func Example()
    Local $hIPC = _InterProcess('F23B0E88-ED9F-11E3-8179-82ADECBA0006', Default) ; Start the interprocess communication.
    _InterProcess_Monitor($hIPC)

    If _InterProcess_IsServerExists($hIPC) And Not _InterProcess_SendToServer($hIPC, 'This is a sample string') Then ; Send a sample string if there is a main process already running.
        MsgBox($MB_SYSTEMMODAL, 'Second Instance: ' & @AutoItPID, _
                'Seems there was an error sending the IPC message, but more than likely the string was blank.')
    EndIf

    Local $hWnd = 0, _
            $iMsg = 0, _
            $sMsg = ''
    Local Const $SERVER_CLOSE_PROCESS = 1001
    While 1
        Switch GUIGetMsg()
            Case _InterProcess_GetMonitorID($hIPC) ; The monitoring id used to notify when an IPC message is received.
                ; If the process is an server i.e. the first instance, then read the data sent by a client and
                ; respond that the IPC message was received
                If _InterProcess_IsThisServer($hIPC) Then
                    If _InterProcess_GetData($hIPC, $hWnd, $sMsg, $iMsg) Then
                        MsgBox($MB_SYSTEMMODAL, 'First Instance: ' & @AutoItPID, _
                                'hWnd: ' & $hWnd & @CRLF & _
                                'Data: ' & $sMsg & @CRLF & _
                                'Message: ' & $iMsg & @CRLF) ; Parse the relevant handle and data from the message.

                        If $iMsg = $SERVER_CLOSE_PROCESS Then ; Check the $iMsg parameter doesn't contain the message to close this instance.
                            ExitLoop ; If the $iMsg parameter is equal to $IPC_CLOSE_PROCESS (1001) the close the first instance.
                        Else
                            _InterProcess_SendToClient($hIPC, $hWnd, 'The data was successfully received by the first instance (server). This second instance (client) will now close. Thanks.')
                        EndIf
                    EndIf
                    ; If the process is not the first instance also known as a client, then wait for the server to send a reply that it
                    ; successfully recived the IPC message.
                ElseIf _InterProcess_IsThisClient($hIPC) Then
                    If _InterProcess_GetData($hIPC, $hWnd, $sMsg, $iMsg) Then
                        MsgBox($MB_SYSTEMMODAL, 'Second Instance: ' & @AutoItPID, _
                                'hWnd: ' & $hWnd & @CRLF & _
                                'Data: ' & $sMsg & @CRLF & _
                                'Message: ' & $iMsg & @CRLF) ; Parse the relevant handle and data from the message.
                        _InterProcess_SendToServer($hIPC, 'The second instance (client) recieved the message to close their instance so this instance (server) will close too.', $SERVER_CLOSE_PROCESS)
                        ExitLoop
                    EndIf
                EndIf
        EndSwitch
    WEnd

    _InterProcess_Destroy($hIPC)
EndFunc   ;==>Example
#EndRegion Example

Func _InterProcess($sGUID, $hWnd)
    Local $aIPC[$IPC_MAX]
    $aIPC[$IPC_ID] = $IPC_GUID
    $aIPC[$IPC_AUTOITID] = AutoItWinGetTitle()
    $aIPC[$IPC_ISMONITORING] = False

    If StringRegExp($sGUID, '^(?:\{){0,1}[[:xdigit:]]{8}-(?:[[:xdigit:]]{4}-){3}[[:xdigit:]]{12}(?:\}){0,1}$') Then ; Is GUID.
        $aIPC[$IPC_GLOBALID] = StringUpper($sGUID)
    Else
        $aIPC[$IPC_GLOBALID] = 'IPC_' & $IPC_GUID
    EndIf

    $aIPC[$IPC_CLIENTWND] = $hWnd
    $aIPC[$IPC_CLIENTID] = $aIPC[$IPC_GLOBALID] & '_CLIENT'

    $aIPC[$IPC_SERVERWND] = 0
    $aIPC[$IPC_SERVERID] = $aIPC[$IPC_GLOBALID] & '_SERVER'

    $hWnd = WinGetHandle($aIPC[$IPC_SERVERID])
    If @error Or Not $hWnd Then ; No interprocess communication server exists.
        $aIPC[$IPC_SERVERWND] = 0
    Else
        Local Const $hControl = ControlGetHandle($hWnd, '', 'Edit1')
        $aIPC[$IPC_SERVERWND] = HWnd( _
                StringRegExp('|' & ControlGetText($hWnd, '', $hControl) & '|IPC_WND:0x00000000|', _
                '\|IPC_WND:(0[xX][[:xdigit:]]+)\|', _
                $STR_REGEXPARRAYGLOBALMATCH)[0] _
                ) ; Retrieve the server communication handle.
    EndIf
    Return $aIPC
EndFunc   ;==>_InterProcess

Func _InterProcess_Destroy(ByRef $aIPC)
    Local $bReturn = False
    If __InterProcess_IsAPI($aIPC) Then
        $bReturn = True
        Local $hAutoItWnd = 0
        If _InterProcess_IsThisServer($aIPC) Then
            $hAutoItWnd = WinGetHandle($aIPC[$IPC_SERVERID])
        ElseIf _InterProcess_IsThisClient($aIPC) And _InterProcess_IsClientExists($aIPC) Then
            $hAutoItWnd = WinGetHandle($aIPC[$IPC_CLIENTID])
        EndIf
        If IsHWnd($hAutoItWnd) Then
            Local Const $hControl = ControlGetHandle($hAutoItWnd, '', 'Edit1')
            ControlSetText($hAutoItWnd, '', $hControl, _
                    StringRegExpReplace(ControlGetText($hAutoItWnd, '', $hControl), _
                    '(?<=\n)\|IPC_(?:WND|PID):\V+\R', _
                    '')) ; Destroy the communication handle and PID.

            ; Destroy the associated GUI.
            GUIRegisterMsg($WM_COPYDATA, '')
            If $aIPC[$IPC_MONITORID] > 0 Then
                GUICtrlDelete($aIPC[$IPC_MONITORID])
            EndIf
            If IsHWnd($aIPC[$IPC_CLIENTWND]) Then
                GUIDelete($aIPC[$IPC_CLIENTWND])
            EndIf
        EndIf
        _InterProcess_Destroy_Monitor($aIPC)

        AutoItWinSetTitle($aIPC[$IPC_AUTOITID])
    EndIf
    $aIPC = Null ; Destroy the contents of the API.
    Return $bReturn
EndFunc   ;==>_InterProcess_Destroy

Func _InterProcess_Destroy_Monitor(ByRef $aIPC)
    Local $bReturn = False
    If __InterProcess_IsAPI($aIPC) And $aIPC[$IPC_ISMONITORING] Then
        $IPC[$IPC_CONTROLID] = 0
        $aIPC[$IPC_ISMONITORING] = False
        $bReturn = True
    EndIf
    Return $bReturn
EndFunc   ;==>_InterProcess_Destroy_Monitor

Func _InterProcess_GetClientID(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) ? $aIPC[$IPC_CLIENTID] : Null
EndFunc   ;==>_InterProcess_GetClientID

Func _InterProcess_GetGlobalID(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) ? $aIPC[$IPC_GLOBALID] : Null
EndFunc   ;==>_InterProcess_GetGlobalID

Func _InterProcess_GetMonitorID(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) ? $aIPC[$IPC_MONITORID] : 0
EndFunc   ;==>_InterProcess_GetMonitorID

Func _InterProcess_GetServerID(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) ? $aIPC[$IPC_SERVERID] : Null
EndFunc   ;==>_InterProcess_GetServerID

Func _InterProcess_GetData(ByRef $aIPC, ByRef $hWnd, ByRef $sMsg, ByRef $iMsg)
    $hWnd = 0
    $iMsg = 0
    $sMsg = ''

    Local $bReturn = False
    If __InterProcess_IsAPI($aIPC) And ($IPC[$IPC_RECEIVEDDATA] Or $IPC[$IPC_RECEIVEDMSG]) Then
        $bReturn = True
        $hWnd = (IsHWnd($IPC[$IPC_RECEIVEDWND]) ? $IPC[$IPC_RECEIVEDWND] : Null) ; hWnd.
        $iMsg = Int($IPC[$IPC_RECEIVEDMSG])
        $sMsg = $IPC[$IPC_RECEIVEDDATA] ; Data
    EndIf
    $IPC[$IPC_RECEIVEDDATA] = ''
    $IPC[$IPC_RECEIVEDWND] = 0
    $IPC[$IPC_RECEIVEDMSG] = 0
    Return $bReturn
EndFunc   ;==>_InterProcess_GetData

Func _InterProcess_GetClientWnd(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) ? $aIPC[$IPC_CLIENTWND] : Null
EndFunc   ;==>_InterProcess_GetClientWnd

Func _InterProcess_GetServerWnd(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) ? (_InterProcess_IsThisServer($aIPC) ? $aIPC[$IPC_CLIENTWND] : $aIPC[$IPC_SERVERWND]) : Null
EndFunc   ;==>_InterProcess_GetServerWnd

Func _InterProcess_IsClientExists(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) And IsHWnd($aIPC[$IPC_CLIENTWND]) And $aIPC[$IPC_MONITORID] > 0
EndFunc   ;==>_InterProcess_IsClientExists

Func _InterProcess_IsMonitoring(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) And $aIPC[$IPC_ISMONITORING]
EndFunc   ;==>_InterProcess_IsMonitoring

Func _InterProcess_IsServerExists(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) And IsHWnd($aIPC[$IPC_SERVERWND])
EndFunc   ;==>_InterProcess_IsServerExists

Func _InterProcess_IsThisServer(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) And Not IsHWnd($aIPC[$IPC_SERVERWND])
EndFunc   ;==>_InterProcess_IsThisServer

Func _InterProcess_IsThisClient(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) And Not _InterProcess_IsThisServer($aIPC)
EndFunc   ;==>_InterProcess_IsThisClient

Func _InterProcess_Monitor(ByRef $aIPC)
    Local $bReturn = False
    If __InterProcess_IsAPI($aIPC) And Not $aIPC[$IPC_ISMONITORING] Then
        $aIPC[$IPC_ISMONITORING] = True
        If _InterProcess_IsThisServer($aIPC) And Not _InterProcess_IsClientExists($aIPC) Then
            __InterProcess_Create($aIPC[$IPC_CLIENTWND], $aIPC[$IPC_MONITORID], $aIPC[$IPC_SERVERID])
        ElseIf _InterProcess_IsThisClient($aIPC) And Not _InterProcess_IsClientExists($aIPC) Then
            __InterProcess_Create($aIPC[$IPC_CLIENTWND], $aIPC[$IPC_MONITORID], $aIPC[$IPC_CLIENTID])
        EndIf
        $IPC[$IPC_CONTROLID] = $aIPC[$IPC_MONITORID]
        $bReturn = True
    EndIf
    Return $bReturn
EndFunc   ;==>_InterProcess_Monitor

Func _InterProcess_SendToServer(ByRef $aIPC, $sMsg, $iMsg = Default)
    Return __InterProcess_IsAPI($aIPC) And __InterProcess_Send($aIPC[$IPC_CLIENTWND], $aIPC[$IPC_SERVERWND], $iMsg, $sMsg)
EndFunc   ;==>_InterProcess_SendToServer

Func _InterProcess_SendToClient(ByRef $aIPC, $hWnd, $sMsg, $iMsg = Default)
    Return __InterProcess_IsAPI($aIPC) And __InterProcess_Send($aIPC[$IPC_CLIENTWND], $hWnd, $iMsg, $sMsg)
EndFunc   ;==>_InterProcess_SendToClient

Func _InterProcess_SetGUID($sGUID)
    $IPC_GUID = $sGUID
    Return True
EndFunc   ;==>_InterProcess_SetGUID

Func __InterProcess_Create(ByRef $hWnd, ByRef $iControl, $sID)
    If Not IsHWnd($hWnd) Or $hWnd = Default Then
        $hWnd = GUICreate('', 0, 0, -99, -99, $GUI_SS_DEFAULT_GUI, $WS_EX_TOOLWINDOW)
        GUISetState(@SW_SHOWNOACTIVATE, $hWnd)
    EndIf
    If IsAdmin() Then
        _WinAPI_ChangeWindowMessageFilterEx($hWnd, $WM_COPYDATA, $MSGFLT_ALLOW)
    EndIf
    If Not $iControl Then
        $iControl = GUICtrlCreateDummy()
    EndIf
    GUIRegisterMsg($WM_COPYDATA, WM_COPYDATA)
    AutoItWinSetTitle($sID)
    Local Const $hAutoItWnd = WinGetHandle($sID)
    Local Const $hControl = ControlGetHandle($hAutoItWnd, '', 'Edit1')
    ControlSetText($hAutoItWnd, '', $hControl, ControlGetText($hAutoItWnd, '', $hControl) & @CRLF & _
            '|IPC_WND:' & $hWnd & '|IPC_PID:' & @AutoItPID & @CRLF) ; Set the communication handle and PID.
    Return True
EndFunc   ;==>__InterProcess_Create

Func __InterProcess_IsAPI(ByRef $aIPC)
    Return UBound($aIPC) = $IPC_MAX And $aIPC[$IPC_ID] = $IPC_GUID
EndFunc   ;==>__InterProcess_IsAPI

Func __InterProcess_Send($hSender, $hReciever, $iMsg, $sMsg)
    If Not IsHWnd($hReciever) Then
        Return SetError(1, 0, False)
    EndIf
    If StringStripWS($sMsg, $STR_STRIPALL) = '' Then
        Return SetError(2, 0, False)
    EndIf
    If Not IsInt($iMsg) Then
        $iMsg = 0
    EndIf
    $sMsg = $IPC_GUID & $sMsg
    Local Const $tBuffer = DllStructCreate('wchar cdata[' & StringLen($sMsg) + 1 & ']')
    DllStructSetData($tBuffer, 'cdata', $sMsg)
    Local Const $tCOPYDATASTRUCT = DllStructCreate($tagCOPYDATASTRUCT)
    DllStructSetData($tCOPYDATASTRUCT, 'dwData', $iMsg)
    DllStructSetData($tCOPYDATASTRUCT, 'cbData', DllStructGetSize($tBuffer))
    DllStructSetData($tCOPYDATASTRUCT, 'lpData', DllStructGetPtr($tBuffer))
    _SendMessage($hReciever, _
            $WM_COPYDATA, _
            $hSender, _
            DllStructGetPtr($tCOPYDATASTRUCT))
    Return Not @error
EndFunc   ;==>__InterProcess_Send

Func WM_COPYDATA($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg
    Local Const $tCOPYDATASTRUCT = DllStructCreate($tagCOPYDATASTRUCT, $lParam)
    Local Const $tBuffer = DllStructCreate('wchar cdata[' & DllStructGetData($tCOPYDATASTRUCT, 'cbData') / 2 & ']', DllStructGetData($tCOPYDATASTRUCT, 'lpData'))
    $IPC[$IPC_RECEIVEDDATA] = StringRegExpReplace(DllStructGetData($tBuffer, 'cdata'), '^' & $IPC_GUID, '') ; Data.
    If @extended > 0 Then
        $IPC[$IPC_RECEIVEDWND] = $wParam ; hWnd.
        $IPC[$IPC_RECEIVEDMSG] = DllStructGetData($tCOPYDATASTRUCT, 'dwData') ; Message.
        If $IPC[$IPC_CONTROLID] > 0 Then
            GUICtrlSendToDummy($IPC[$IPC_CONTROLID]) ; Send to the control.
        EndIf
    Else
        $IPC[$IPC_RECEIVEDDATA] = ''
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COPYDATA
Edited by guinness
3 people like this

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites



Thanks ever so much, I replaced all instances of "dword;dword;ptr" to "ulong_ptr;dword;ptr" and now it works in both x32 & x64 versions.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

I updated the original post by adding encryption to the data that is sent between both programs and tidied up WM_COPYDATA_SENDDATA().


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

I needed a function just like thjis for a project I was working on. The first step in using it was understanding how it works. In order to do this I rewrote the sample example function provided to better represent how I would be using it. While not near as compact as the example script in the orginal post, it's much clearer or at least it's clearer to me.

Thinking this reworked example my be of use to someone else I figured I would post it here.

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7

#include <GUIConstantsEx.au3>
#include <WinAPISys.au3>
#include <WindowsConstants.au3>
#include <Timers.au3>

Global Const $tagCOPYDATASTRUCT = 'ulong_ptr dwData;' & _ 
        'dword cbData;' & _
        'ptr lpData'
Global $IPC_GUID = 'E23D443E-F0E1-11E3-9E5C-90580B9E45A7'
Global Enum $IPC_AUTOITID, _
        $IPC_CLIENTWND, $IPC_CLIENTID, _
        $IPC_GLOBALID, _
        $IPC_ID, $IPC_ISMONITORING, _
        $IPC_MONITORID, _
        $IPC_SERVERWND, $IPC_SERVERID, _
        $IPC_MAX
Global Enum $IPC_CONTROLID, _
        $IPC_RECEIVEDDATA, $IPC_RECEIVEDWND, $IPC_RECEIVEDMSG, _
        $IPC__MAX
Global $IPC[$IPC__MAX] ; Internal array for the interprocess communication functions.
$IPC[$IPC_CONTROLID] = 0

#Region Example
;----------------------------------------
;-- Do an example but only if compiled --
;----------------------------------------
If @Compiled Then
    Example()
Else
    MsgBox($MB_SYSTEMMODAL, '', 'Please compile the example before running.')
EndIf

Func Example()

    ;--------------------------------------------------
    ;-- Start server but only if not already started --
    ;--------------------------------------------------
    Local $hIPC = _InterProcess('F23B0E88-ED9F-11E3-8179-82ADECBA0006', Default)    ;Start the interprocess communication.
    _InterProcess_Monitor($hIPC)                                                    ;Verify Client has a server etc.
    Local   $hWnd = 0, _                                            
            $iMsg = 0, _
            $sMsg = ''                                                              ;Values used to track clients etc.
    Local Const $SERVER_CLOSE_PROCESS = 1001                                        ;integer values passed back and forth as flags
    Local Const $SERVER_MESSAGE_RECEIVED = 1002

    If _InterProcess_IsThisClient($hIPC) Then                                       ;Is this a client run of the ie. server exist

        ;---------------------------------------------
        ;-- Send message to 1st instance of program --
        ;---------------------------------------------
        DIM $Message                                                                ;server exist send a message
        $Message = "This is a Sample Message sent to First Instance"                ;to 1st copy of this program that is running and is server
        If NOT _InterProcess_SendToServer($hIPC, $Message) Then                     ;some type of error sending message
            MsgBox($MB_SYSTEMMODAL, 'Second Instance: ' & @AutoItPID, 'Seems there was an error sending the IPC message, but more than likely the string was blank.')
        EndIf
        Local $hStarttime = _Timer_Init()
        While 1                                                                     ;Now wait for response from 1st copy of message
            IF GUIGetMsg() = _InterProcess_GetMonitorID($hIPC) Then                 ;The monitoring id used to notify when an IPC message is received.
                If _InterProcess_IsThisClient($hIPC) Then
                    If _InterProcess_GetData($hIPC, $hWnd, $sMsg, $iMsg) Then
                        IF $iMsg = $SERVER_MESSAGE_RECEIVED Then
                            IF MsgBox($MB_YESNO,'Second Instance: ' & @AutoItPID,"Message recieved by first instance of program" & @CRLF & "Close server ?") = $IDYES Then
                                _InterProcess_SendToServer($hIPC, "Null", $SERVER_CLOSE_PROCESS)
                            EndIf
                            Exit
                        EndIf
                    EndIf
                EndIf
            EndIf
            sleep(500)
            IF _Timer_Diff($hStarttime) > 5000 Then
                MsgBox(0,'Second Instance: ' & @AutoItPID,"Message NOT recieved by first instance of program")
                Exit
            EndIf
        WEnd
    EndIf

    If _InterProcess_IsThisServer($hIPC) Then                                       ;Is this to be the server instance of program

        ;---------------------------------------------------------------
        ;-- Start up first instance of program and wait for a message --
        ;---------------------------------------------------------------
        While 1                                                                     ;go into loop monitoring interprocess communications
            IF GUIGetMsg() = _InterProcess_GetMonitorID($hIPC) Then                 ;The monitoring id used to notify when an IPC message is received.
                                                                                    ;If this instance of the program is an server i.e. the first instance,
                                                                                    ; then read the data sent by a client and respond that the IPC message was received
                If _InterProcess_GetData($hIPC, $hWnd, $sMsg, $iMsg) Then
                                                                                    ;need to provide a none null message for this to work
                    _InterProcess_SendToClient($hIPC, $hWnd,"Null Message", $SERVER_MESSAGE_RECEIVED)
                    If $iMsg = $SERVER_CLOSE_PROCESS Then                           ; Check the $iMsg parameter doesn't contain the message to close this instance.
                        MsgBox($MB_SYSTEMMODAL,'First Instance: ' & @AutoItPID,"1St instance recieved Message to close")
                        ExitLoop                                                    ;close the server by droping out of loop which allows server to be closed
                    EndIf
                    MsgBox($MB_SYSTEMMODAL, 'First Instance: ' & @AutoItPID, _
                        'hWnd: ' & $hWnd & @CRLF & _
                        'Data: ' & $sMsg & @CRLF & _
                        'Message: ' & $iMsg & @CRLF)                                ; Parse the relevant handle and data from the message.
                EndIf
            EndIf
            sleep(500)
        WEnd
        _InterProcess_Destroy($hIPC)                                                ;close inter process communication channel

    EndIf

EndFunc   ;==>Example
#EndRegion Example

;-------------------------------------------
;-- Interprocess Communications Functions --
;-------------------------------------------
Func _InterProcess($sGUID, $hWnd)
    Local $aIPC[$IPC_MAX]
    $aIPC[$IPC_ID] = $IPC_GUID
    $aIPC[$IPC_AUTOITID] = AutoItWinGetTitle()
    $aIPC[$IPC_ISMONITORING] = False

    If StringRegExp($sGUID, '^(?:\{){0,1}[[:xdigit:]]{8}-(?:[[:xdigit:]]{4}-){3}[[:xdigit:]]{12}(?:\}){0,1}$') Then ; Is GUID.
        $aIPC[$IPC_GLOBALID] = StringUpper($sGUID)
    Else
        $aIPC[$IPC_GLOBALID] = 'IPC_' & $IPC_GUID
    EndIf

    $aIPC[$IPC_CLIENTWND] = $hWnd
    $aIPC[$IPC_CLIENTID] = $aIPC[$IPC_GLOBALID] & '_CLIENT'

    $aIPC[$IPC_SERVERWND] = 0
    $aIPC[$IPC_SERVERID] = $aIPC[$IPC_GLOBALID] & '_SERVER'

    $hWnd = WinGetHandle($aIPC[$IPC_SERVERID])
    If @error Or Not $hWnd Then ; No interprocess communication server exists.
        $aIPC[$IPC_SERVERWND] = 0
    Else
        Local Const $hControl = ControlGetHandle($hWnd, '', 'Edit1')
        $aIPC[$IPC_SERVERWND] = HWnd( _
                StringRegExp('|' & ControlGetText($hWnd, '', $hControl) & '|IPC_WND:0x00000000|', _
                '\|IPC_WND:(0[xX][[:xdigit:]]+)\|', _
                $STR_REGEXPARRAYGLOBALMATCH)[0] _
                ) ; Retrieve the server communication handle.
    EndIf
    Return $aIPC
EndFunc   ;==>_InterProcess

Func _InterProcess_Destroy(ByRef $aIPC)
    Local $bReturn = False
    If __InterProcess_IsAPI($aIPC) Then
        $bReturn = True
        Local $hAutoItWnd = 0
        If _InterProcess_IsThisServer($aIPC) Then
            $hAutoItWnd = WinGetHandle($aIPC[$IPC_SERVERID])
        ElseIf _InterProcess_IsThisClient($aIPC) And _InterProcess_IsClientExists($aIPC) Then
            $hAutoItWnd = WinGetHandle($aIPC[$IPC_CLIENTID])
        EndIf
        If IsHWnd($hAutoItWnd) Then
            Local Const $hControl = ControlGetHandle($hAutoItWnd, '', 'Edit1')
            ControlSetText($hAutoItWnd, '', $hControl, _
                    StringRegExpReplace(ControlGetText($hAutoItWnd, '', $hControl), _
                    '(?<=\n)\|IPC_(?:WND|PID):\V+\R', _
                    '')) ; Destroy the communication handle and PID.

            ; Destroy the associated GUI.
            GUIRegisterMsg($WM_COPYDATA, '')
            If $aIPC[$IPC_MONITORID] > 0 Then
                GUICtrlDelete($aIPC[$IPC_MONITORID])
            EndIf
            If IsHWnd($aIPC[$IPC_CLIENTWND]) Then
                GUIDelete($aIPC[$IPC_CLIENTWND])
            EndIf
        EndIf
        _InterProcess_Destroy_Monitor($aIPC)

        AutoItWinSetTitle($aIPC[$IPC_AUTOITID])
    EndIf
    $aIPC = Null ; Destroy the contents of the API.
    Return $bReturn
EndFunc   ;==>_InterProcess_Destroy

Func _InterProcess_Destroy_Monitor(ByRef $aIPC)
    Local $bReturn = False
    If __InterProcess_IsAPI($aIPC) And $aIPC[$IPC_ISMONITORING] Then
        $IPC[$IPC_CONTROLID] = 0
        $aIPC[$IPC_ISMONITORING] = False
        $bReturn = True
    EndIf
    Return $bReturn
EndFunc   ;==>_InterProcess_Destroy_Monitor

Func _InterProcess_GetClientID(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) ? $aIPC[$IPC_CLIENTID] : Null
EndFunc   ;==>_InterProcess_GetClientID

Func _InterProcess_GetGlobalID(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) ? $aIPC[$IPC_GLOBALID] : Null
EndFunc   ;==>_InterProcess_GetGlobalID

Func _InterProcess_GetMonitorID(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) ? $aIPC[$IPC_MONITORID] : 0
EndFunc   ;==>_InterProcess_GetMonitorID

Func _InterProcess_GetServerID(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) ? $aIPC[$IPC_SERVERID] : Null
EndFunc   ;==>_InterProcess_GetServerID

Func _InterProcess_GetData(ByRef $aIPC, ByRef $hWnd, ByRef $sMsg, ByRef $iMsg)
    $hWnd = 0
    $iMsg = 0
    $sMsg = ''

    Local $bReturn = False
    If __InterProcess_IsAPI($aIPC) And ($IPC[$IPC_RECEIVEDDATA] Or $IPC[$IPC_RECEIVEDMSG]) Then
        $bReturn = True
        $hWnd = (IsHWnd($IPC[$IPC_RECEIVEDWND]) ? $IPC[$IPC_RECEIVEDWND] : Null) ; hWnd.
        $iMsg = Int($IPC[$IPC_RECEIVEDMSG])
        $sMsg = $IPC[$IPC_RECEIVEDDATA] ; Data
    EndIf
    $IPC[$IPC_RECEIVEDDATA] = ''
    $IPC[$IPC_RECEIVEDWND] = 0
    $IPC[$IPC_RECEIVEDMSG] = 0
    Return $bReturn
EndFunc   ;==>_InterProcess_GetData

Func _InterProcess_GetClientWnd(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) ? $aIPC[$IPC_CLIENTWND] : Null
EndFunc   ;==>_InterProcess_GetClientWnd

Func _InterProcess_GetServerWnd(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) ? (_InterProcess_IsThisServer($aIPC) ? $aIPC[$IPC_CLIENTWND] : $aIPC[$IPC_SERVERWND]) : Null
EndFunc   ;==>_InterProcess_GetServerWnd

Func _InterProcess_IsClientExists(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) And IsHWnd($aIPC[$IPC_CLIENTWND]) And $aIPC[$IPC_MONITORID] > 0
EndFunc   ;==>_InterProcess_IsClientExists

Func _InterProcess_IsMonitoring(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) And $aIPC[$IPC_ISMONITORING]
EndFunc   ;==>_InterProcess_IsMonitoring

Func _InterProcess_IsServerExists(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) And IsHWnd($aIPC[$IPC_SERVERWND])
EndFunc   ;==>_InterProcess_IsServerExists

Func _InterProcess_IsThisServer(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) And Not IsHWnd($aIPC[$IPC_SERVERWND])
EndFunc   ;==>_InterProcess_IsThisServer

Func _InterProcess_IsThisClient(ByRef $aIPC)
    Return __InterProcess_IsAPI($aIPC) And Not _InterProcess_IsThisServer($aIPC)
EndFunc   ;==>_InterProcess_IsThisClient

Func _InterProcess_Monitor(ByRef $aIPC)
    Local $bReturn = False
    If __InterProcess_IsAPI($aIPC) And Not $aIPC[$IPC_ISMONITORING] Then
        $aIPC[$IPC_ISMONITORING] = True
        If _InterProcess_IsThisServer($aIPC) And Not _InterProcess_IsClientExists($aIPC) Then
            __InterProcess_Create($aIPC[$IPC_CLIENTWND], $aIPC[$IPC_MONITORID], $aIPC[$IPC_SERVERID])
        ElseIf _InterProcess_IsThisClient($aIPC) And Not _InterProcess_IsClientExists($aIPC) Then
            __InterProcess_Create($aIPC[$IPC_CLIENTWND], $aIPC[$IPC_MONITORID], $aIPC[$IPC_CLIENTID])
        EndIf
        $IPC[$IPC_CONTROLID] = $aIPC[$IPC_MONITORID]
        $bReturn = True
    EndIf
    Return $bReturn
EndFunc   ;==>_InterProcess_Monitor

Func _InterProcess_SendToServer(ByRef $aIPC, $sMsg, $iMsg = Default)
    Return __InterProcess_IsAPI($aIPC) And __InterProcess_Send($aIPC[$IPC_CLIENTWND], $aIPC[$IPC_SERVERWND], $iMsg, $sMsg)
EndFunc   ;==>_InterProcess_SendToServer

Func _InterProcess_SendToClient(ByRef $aIPC, $hWnd, $sMsg, $iMsg = Default)
    Return __InterProcess_IsAPI($aIPC) And __InterProcess_Send($aIPC[$IPC_CLIENTWND], $hWnd, $iMsg, $sMsg)
EndFunc   ;==>_InterProcess_SendToClient

Func _InterProcess_SetGUID($sGUID)
    $IPC_GUID = $sGUID
    Return True
EndFunc   ;==>_InterProcess_SetGUID

Func __InterProcess_Create(ByRef $hWnd, ByRef $iControl, $sID)
    If Not IsHWnd($hWnd) Or $hWnd = Default Then
        $hWnd = GUICreate('', 0, 0, -99, -99, $GUI_SS_DEFAULT_GUI, $WS_EX_TOOLWINDOW)
        GUISetState(@SW_SHOWNOACTIVATE, $hWnd)
    EndIf
    If IsAdmin() Then
        _WinAPI_ChangeWindowMessageFilterEx($hWnd, $WM_COPYDATA, $MSGFLT_ALLOW)
    EndIf
    If Not $iControl Then
        $iControl = GUICtrlCreateDummy()
    EndIf
    GUIRegisterMsg($WM_COPYDATA, WM_COPYDATA)
    AutoItWinSetTitle($sID)
    Local Const $hAutoItWnd = WinGetHandle($sID)
    Local Const $hControl = ControlGetHandle($hAutoItWnd, '', 'Edit1')
    ControlSetText($hAutoItWnd, '', $hControl, ControlGetText($hAutoItWnd, '', $hControl) & @CRLF & _
            '|IPC_WND:' & $hWnd & '|IPC_PID:' & @AutoItPID & @CRLF) ; Set the communication handle and PID.
    Return True
EndFunc   ;==>__InterProcess_Create

Func __InterProcess_IsAPI(ByRef $aIPC)
    Return UBound($aIPC) = $IPC_MAX And $aIPC[$IPC_ID] = $IPC_GUID
EndFunc   ;==>__InterProcess_IsAPI

Func __InterProcess_Send($hSender, $hReciever, $iMsg, $sMsg)
    If Not IsHWnd($hReciever) Then
        Return SetError(1, 0, False)
    EndIf
    If StringStripWS($sMsg, $STR_STRIPALL) = '' Then
        Return SetError(2, 0, False)
    EndIf
    If Not IsInt($iMsg) Then
        $iMsg = 0
    EndIf
    $sMsg = $IPC_GUID & $sMsg
    Local Const $tBuffer = DllStructCreate('wchar cdata[' & StringLen($sMsg) + 1 & ']')
    DllStructSetData($tBuffer, 'cdata', $sMsg)
    Local Const $tCOPYDATASTRUCT = DllStructCreate($tagCOPYDATASTRUCT)
    DllStructSetData($tCOPYDATASTRUCT, 'dwData', $iMsg)
    DllStructSetData($tCOPYDATASTRUCT, 'cbData', DllStructGetSize($tBuffer))
    DllStructSetData($tCOPYDATASTRUCT, 'lpData', DllStructGetPtr($tBuffer))
    _SendMessage($hReciever, _
            $WM_COPYDATA, _
            $hSender, _
            DllStructGetPtr($tCOPYDATASTRUCT))
    Return Not @error
EndFunc   ;==>__InterProcess_Send

Func WM_COPYDATA($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg
    Local Const $tCOPYDATASTRUCT = DllStructCreate($tagCOPYDATASTRUCT, $lParam)
    Local Const $tBuffer = DllStructCreate('wchar cdata[' & DllStructGetData($tCOPYDATASTRUCT, 'cbData') / 2 & ']', DllStructGetData($tCOPYDATASTRUCT, 'lpData'))
    $IPC[$IPC_RECEIVEDDATA] = StringRegExpReplace(DllStructGetData($tBuffer, 'cdata'), '^' & $IPC_GUID, '') ; Data.
    If @extended > 0 Then
        $IPC[$IPC_RECEIVEDWND] = $wParam ; hWnd.
        $IPC[$IPC_RECEIVEDMSG] = DllStructGetData($tCOPYDATASTRUCT, 'dwData') ; Message.
        If $IPC[$IPC_CONTROLID] > 0 Then
            GUICtrlSendToDummy($IPC[$IPC_CONTROLID]) ; Send to the control.
        EndIf
    Else
        $IPC[$IPC_RECEIVEDDATA] = ''
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COPYDATA

Share this post


Link to post
Share on other sites

Instead of copying the UDF functions, maybe would have been better to just post an example. I am looking at updating the code in a week or so, hence your version will be old and outdated. I appreciate your example (though the Dim is redundant), but would prefer the reduction in code redundancy.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I'm thinking of splitting my app into 2 maybe 3 apps so things run smoother and faster. How do I impliment this function to enable the communication between them..I'm using 32bit?

Edited by Champak

Share this post


Link to post
Share on other sites

How much data can this pass? Can it pass an array?

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I don't know if there is a limitation and no it can't, only a string buffer.

Edited by guinness
Whoops, ggs instead of ffs

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

I dont know if I'm missing something, but

1/ what is the purpose of the data put in _InterProcess()? I put different data in the sending and receiving app and they are still communicating. I thought what I put in there determines the communication path so they know they are communicating with each other. I plan on using this between three apps for intercommunicating.

2/ what is the difference between $imsg and $smsg and the best way to implement them?

 

Thanks.

Share this post


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