Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IS8Simulation *pis8 = NULL;
- ...
- CoCreateInstance(
- clsid,
- NULL,
- CLSCTX_LOCAL_SERVER,
- __uuidof(IS8Simulation),
- (void **) &pis8);
- ...
- hThread = CreateThread(
- NULL,
- 0,
- SecondaryThread,
- //interface pointer pis8
- 0,
- &dwGenericThreadID);
- ...
- DWORD WINAPI SecondaryThread(LPVOID iValue)
- {
- //using iValue accordingly
- //E.g.: iValue->Open
- hThread = CreateThread(
- NULL,
- 0,
- SecondaryThread,
- (LPVOID) pis8
- 0,
- &dwGenericThreadID);
- DWORD WINAPI SecondaryThread(LPVOID iValue)
- {
- ((IS8Simulation*) iValue)->Open();
- }
- void MainThread()
- {
- IStream* psis8;
- HRESULT res = CoMarshalInterThreadInterfaceInStream (IID_IS8SIMULATION, pis8, &psis8);
- if (FAILED(res))
- return;
- hThread = CreateThread(
- NULL,
- 0,
- SecondaryThread,
- (LPVOID) psis8
- 0,
- &dwGenericThreadID
- );
- }
- DWORD WINAPI SecondaryThread(LPVOID iValue)
- {
- IS8Simulation* pis8;
- HRESULT res = CoGetInterfaceAndReleaseStream((IStream*) iValue, IID_IS8SIMULATION, &pis8);
- if (FAILED(res))
- return (DWORD) res;
- pis8->Open();
- }
Add Comment
Please, Sign In to add comment