Passing objects between programs...
I would like to be able to shell a program from a program, but be able to pass my objects over to it. Is there anyway to do this reliably? Both programs are written in VB6, if that helps. It may be possible that I need to END the first program, which is why I want to pass the objects over to the second program. TIA.
Re: Passing objects between programs...
Theres 2 ways that come to mind when doing this.
Option 1): Completely duplicate the object in app2 as in app1 (whether it be a class object, or a commandbutton)
Option 2): Allocate memory in app2, then in app1, use CopyMemory to copy the object into the memory app2 has set aside (well, used up). Then use CopyMemory in app2 to move the memory into an Object Variable (or a class).
Using CopyMemory would require alot of reading up on to do it properly, and I'm not that qualified to give a good example of CopyMemory (although in ASM I could give an example).
chem
Re: Passing objects between programs...
I'm sure there is ALOT to be careful with when using that copymem function. Will it be able to assign the correct data to the correct objects? I think the data will be class objects, ultimately.
Re: Passing objects between programs...
can't you do this with an ActiveX dll?
Re: Passing objects between programs...
I have made but 1 dll before, so I am incredibly new to that aspect of programming. I thought no matter what you do, you need to pass something to the DLL in order for it to work with the data. I made a collection with an instance of a class inside it, but in order to do a Exists() function, I could only pass the information to the dll. Is this what you are talking about?
Re: Passing objects between programs...
Quote:
Originally Posted by tacoman667
I'm sure there is ALOT to be careful with when using that copymem function. Will it be able to assign the correct data to the correct objects? I think the data will be class objects, ultimately.
Could you not just create the same class in both applications, and save the classes data to a file and load it again? You could experiment with things like AddressOf and make a CallBack function which app1 calls and app2 executes. I've tried it before, and sorta got it working. If you try using SetWindowLong with the GWL_WNDPROC or GWL_HINSTANCE flags and run app2 before app1, then make app1 send the SetWindowLong, app2 executes a function. Meh, I'll see if I have it in my backups.
chem
Re: Passing objects between programs...
Check out this thread for info on creating ActiveX dlls
http://www.vbforums.com/showthread.php?t=341860
What I am suggesting is to put all the classes you want to share between programs into the dll. Then both programs can access them.