If you're looking for an example of cross application communication (passing info between EXE's) then here's an example I put together a while back this year.
It demonstrates the use of an ActiveX EXE (out of process server) to allow 2 or more external applications to connect to it and share data:
Create a new ActiveX EXE project:
Code:
'In a Standard Module..
'Global CommandLine Object
Public oCommandLine As CommandLine
'No. of Current Connections
Public lConnected As Long
Code:
'In a Class Module Called: Connector
'Instancing: 5 - MultiUse
'
Private Sub Class_Initialize()
'If the Global CommandLine Object isn't Initialized, then Initialize it
If oCommandLine Is Nothing Then
Set oCommandLine = New CommandLine
End If
'Increment the number of Connections to this Object
lConnected = lConnected + 1
End Sub
Private Sub Class_Terminate()
'Decrement the Number of Connections to this Object
lConnected = lConnected - 1
'If the No. of Connections is Zero, Destroy the Global
'Command Line Object, Releasing the ActiveX EXE
If lConnected = 0 Then Set oCommandLine = Nothing
End Sub
Public Property Get CommandLine() As CommandLine
'Return a Reference to the Global CommandLine Object
Set CommandLine = oCommandLine
End Property
Code:
'In a Class Module Called: CommandLine
'Instancing: 2 - PublicNotCreatable
'
Public Event Change()
Private sString As String
Public Property Get szString() As String
'Return the Value of the szString Property
szString = sString
End Property
Public Property Let szString(ByVal vNewValue As String)
'Set the Value of the szString Property and Trigger
'the Change Event
sString = vNewValue
RaiseEvent Change
End Property
Compile the Project into an EXE, call the ActiveX Project/EXE "AppExtender"
Create a Standard EXE Project:
Code:
'In a Standard Module:
'Create a Private Instance of the CommandLine Object
'So that we can still change the Commandline if
'we have to unload this Instance..
Private oCommandLine As AppExtender.CommandLine
'Create a Public Connector Object, used to get a
'Reference to the Globally Shared CommandLine Object..
Public oConnector As New AppExtender.Connector
Sub Main()
'Get the CommandLine Object..
Set oCommandLine = oConnector.CommandLine
'If this is the 1st Instance, show the Form
If Not App.PrevInstance Then Form1.Show
'Set the CommandLine Object's szString Property to
'this instances CommandLine, Triggering the Change
'Event of the CommandLine Object in the Other Instance.
oCommandLine.szString = Command
End Sub
Code:
'In a Form with a Textbox
'Create a Private Instance of the CommandLine Object with
'the Change Event, which will Trigger Each Time the szString
'Property of the CommandLine Object is Changed, in any App.
Private WithEvents oCommandLine As AppExtender.CommandLine
Private Sub Form_Load()
'Get the CommandLine Object from the Public Connector
Set oCommandLine = oConnector.CommandLine
End Sub
Private Sub oCommandLine_Change()
'Triggered when the value of szString changes
Text1 = oCommandLine.szString
End Sub
Set the Startup Object for the Project to "SubMain" and compile the Project into an EXE.
Now drag any file onto the EXE and the 1st time it will load the Form and display the dropped files name and path in the Textbox.
Leave the Form open and drag another file onto the EXE, this time instead of showing another Form, the new EXE passes the file name and path to the 1st instance of the program via the "AppExtender" ActiveX Server.
Hope this helps.