Link to home
Start Free TrialLog in
Avatar of Moin
Moin

asked on

Marshling problem???

Hi,
I have two apps., a server and a client.
Client sends query to the server and server executes it thru OLE DB classes.
Now I want to pass the CRowSet pointer back to the client, how can I do this.
Waiting for reply...
Thanx in advance for help
ASKER CERTIFIED SOLUTION
Avatar of Wyn
Wyn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Wyn
Wyn

o? answer? sigh!
You can not really pass pointer between process.

if you client and server in the same process:
use CoMarshalInterThreadInterfaceInStream and
CoGetInterfaceAndReleaseStream.
but these two function require pointer as interface and pass between threads,for you case ,you have two chooses: wrap it as an interface or use user_message in your program to simulate.
but these two function require pointer as interface and pass between threads,for you case ,you have two chooses: wrap it as an interface or use user_message in your program to simulate.
but these two function require pointer as interface and pass between threads,for you case ,you have two chooses: wrap it as an interface or use user_message in your program to simulate.
sorry for these mutil-mess.
Avatar of Moin

ASKER

Please explain in detail.
Thanx
Moin,I dont know your code but here is a way.If you need more ,please put your problem in detail.

So,your server is .exe on the same machine,right?
There are many ways.

Make it as an interface.i.e:

Delegate an interface,say CProxyRowSet to wrap the functions of CRowset and in the construction of the interface do all the chores to establish the CRowset pointer .
e.g:
Class CProxyRowSet:public IProxyRowSet
{
private:
CRowSet* m_rowset;
public:
CProxyRowSet(){//here set up the //pointer you want to pass}

A()
{
m_rowset->A() ;
.............
};
/*here delegate A() of CRowSet to interface CProxyRowSet*/
}

Then after this,you can simple let OLE RUNTIME using RPC to create the proxy and stub in between and return the pointer as common interface.When you want to pass the pointer ,just let the user query this pointer.The user can treate and use it as a real CROWSET POINTER.
Best Regards.
Wyn