is it possible user-defined data types transfer direct between applications without write in a tmp-file?
A short type example:
Code:
Type Artikel
TeileNR as Long
Beschreibung As String * 28
Dichte As Double
Laenge As Double
Breite As Double
End Type
Type Material
Lieferant As String * 20
TypSorte As String * 20
lLiefMat As Long
KostenKg As Double
End Type
Public Type saaXF
KopfDaten(0 To 4) As String * 20
dDatum As Date
lStand As Long
Files(0 To 10) As Long
Art As Artikel
Mat As Material
sComment As String * 312
End Type
Public saA As saaXF
I know a little about SendMessage and DDE to transmit strings. But I don't want to transmit each string and value separately because the actual type is much more complex.
Are both Apps written in VB6?
1) If yes, you could compile them as ActiveX-EXE's, and reference them to each other. That way you could use Public Objects and their methods
1b) Write an ActiveX-Dll which is referenced by both apps, which is kind of "man in the middle". Usage as above
2) You could use Winsock to transfer the UDT as a ByteStream
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
You could also use Far Memory and write the UDT to Far Memory pretty much just like a file.
Here's a post where I explored doing that with arrays. But search for OpenFileMapping in the CodeBank and there are other examples where people are using this approach to just write typical files to Far Memory. I know Dilettante and The Trick have done similar things.
Also, a named pipe sounds like a pretty good way to me as well.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Using an ActiveX Exe without registration? I thought this was not possible!
Do you have a sample/article/reference for using "the OBJREF moniker"?
I meant Standard EXE, not ActiveX EXE. This is an example:
UDT (inside an AxDll):
Code:
Public Type TUserType
sStr As String
bData() As Byte
cObj As Object
End Type
App1:
Code:
Option Explicit
Public Sub Callback( _
ByRef t As TUserType)
MsgBox TypeName(t.cObj) & " " & t.sStr
End Sub
Private Sub Form_Load()
Dim cMnk As IMoniker
Dim cBind As IBindCtx
Dim pStrMnk As Long
Dim sStrMnk As String
Set cMnk = CreateObjrefMoniker(Me)
Set cBind = CreateBindCtx()
pStrMnk = cMnk.GetDisplayName(cBind, Nothing)
sStrMnk = SysAllocString(pStrMnk)
CoGetMalloc(1).Free pStrMnk
' // Create app
Shell "app2.exe """ & sStrMnk & """", vbNormalFocus
End Sub
App2:
Code:
Option Explicit
Private Declare Function PathUnquoteSpaces Lib "shlwapi" _
Alias "PathUnquoteSpacesW" ( _
ByVal p As Long) As Long
Private m_cServer As Object
Private Sub cmdCall_Click()
Dim t As TUserType
Set t.cObj = Me
t.sStr = "Hello"
t.bData = StrConv("12345", vbFromUnicode)
m_cServer.Callback t
End Sub
Private Sub Form_Load()
Dim pArg As Long
pArg = StrPtr(Command$)
PathUnquoteSpaces pArg
Set m_cServer = GetObject(SysAllocString(pArg))
End Sub
When we click cmdCall button in App2 it calls Callback method from App1 and passes UDT with the referenced types.
Using an ActiveX Exe without registration? I thought this was not possible!
Do you have a sample/article/reference for using "the OBJREF moniker"?
It says "Standard EXE project" pretending to be an ActiveX EXE by sharing instances through OBJREF monikers i.e. without registering class factories in registry and ROT like an Ax-EXE does.
For my problem here I want to use the idea of Zvoni with the dll as "man in the middle", but I can't quite figure out how to pass the complete dataset (udt) (see the very simplified example).