Jump to content

Sharing Stuff between 2 Running Scripts


piccaso
 Share

Recommended Posts

Its nothing special, but i had a hard time working it out...

Reciver:

; Windows Definitions
Global Const $StructDef_COPYDATA = "ptr;dword;ptr"
Global Const $WM_COPYDATA = 0x4A
Global Const $WM_CLOSE = 0x10
; The costum Struct (Must be the same in Sender and Recivcer)
Global Const $STRUCTDEF_AU3MESSAGE = "char[256];int"

; Create Reciver window
$hwmd_Reciver = GUICreate("CopyDataRcv")
; Register Windows Messages
GUIRegisterMsg($WM_COPYDATA, "_GUIRegisterMsgProc")
GUIRegisterMsg($WM_CLOSE, "_GUIRegisterMsgProc")
; Message Handler
Func _GUIRegisterMsgProc($hWnd, $MsgID, $WParam, $LParam)
    If $MsgID = $WM_COPYDATA Then
        ; We Recived a WM_COPYDATA Message
        ; $LParam = Poiter to a COPYDATA Struct
        $vs_cds = DllStructCreate($StructDef_COPYDATA, $LParam)
        ; Member No. 3 of COPYDATA Struct (PVOID lpData;) = Pointer to Costum Struct
        $vs_msg = DllStructCreate($STRUCTDEF_AU3MESSAGE, DllStructGetData($vs_cds, 3))
        ; Display what we have recived
        MsgBox(0, "Test String", DllStructGetData($vs_msg, 1))
        MsgBox(0, "Test Integer", DllStructGetData($vs_msg, 2))
    ElseIf $MsgID = $WM_CLOSE Then
        ; We Recived a WM_CLOSE Message
        Exit
    EndIf
EndFunc   ;==>_GUIRegisterMsgProc
; Keep it Runnig ...
While 1
    Sleep(250)
WEnd
maybe its usefull to someone else too :o Edited by piccaso
CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Link to comment
Share on other sites

  • 1 year later...

I find it hard to believe that not one person has made a comment on this since it was posted more than a year ago.

Good work picasso :) , this is exactly what I was looking for. :)

Link to comment
Share on other sites

  • 8 months later...

Its nothing special, but i had a hard time working it out...

Reciver:

; Windows Definitions
Global Const $StructDef_COPYDATA = "ptr;dword;ptr"
Global Const $WM_COPYDATA = 0x4A
Global Const $WM_CLOSE = 0x10
; The costum Struct (Must be the same in Sender and Recivcer)
Global Const $STRUCTDEF_AU3MESSAGE = "char[256];int"

; Create Reciver window
$hwmd_Reciver = GUICreate("CopyDataRcv")
; Register Windows Messages
GUIRegisterMsg($WM_COPYDATA, "_GUIRegisterMsgProc")
GUIRegisterMsg($WM_CLOSE, "_GUIRegisterMsgProc")
; Message Handler
Func _GUIRegisterMsgProc($hWnd, $MsgID, $WParam, $LParam)
    If $MsgID = $WM_COPYDATA Then
        ; We Recived a WM_COPYDATA Message
        ; $LParam = Poiter to a COPYDATA Struct
        $vs_cds = DllStructCreate($StructDef_COPYDATA, $LParam)
        ; Member No. 3 of COPYDATA Struct (PVOID lpData;) = Pointer to Costum Struct
        $vs_msg = DllStructCreate($STRUCTDEF_AU3MESSAGE, DllStructGetData($vs_cds, 3))
        ; Display what we have recived
        MsgBox(0, "Test String", DllStructGetData($vs_msg, 1))
        MsgBox(0, "Test Integer", DllStructGetData($vs_msg, 2))
    ElseIf $MsgID = $WM_CLOSE Then
        ; We Recived a WM_CLOSE Message
        Exit
    EndIf
EndFunc   ;==>_GUIRegisterMsgProc
; Keep it Runnig ...
While 1
    Sleep(250)
WEnd
maybe its usefull to someone else too :D
I found this old post and i have interest to get idea how it is working?

Can someone would be able to help with examples?

Best Regards

Be Green Now or Never (BGNN)!

Link to comment
Share on other sites

no exemple ?

Half an example.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • 1 year later...

Sorry to bump an old one but does anyone have a working example. I'm having a hard time figuring it out...

Thanks in advance...

Tip

http://www.autoitscript.com/forum/index.php?s=&showtopic=94887&view=findpost&p=681941
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...