Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I'm trying to load an IStream on a file and share it with several classes (clients). The Code is as Follow :
C++
IStream* pStream;

HRESULT hr = ::SHCreateStreamOnFileEx(wsfilePath, STGM_FAILIFTHERE | STGM_DIRECT_SWMR | STGM_READ | STGM_SHARE_DENY_NONE, FILE_ATTRIBUTE_READONLY, FALSE, NULL, &pStream);
if(hr == S_OK)
{
	for(auto it=ptrCallbackMap.begin();it!=ptrCallbackMap.end();++it)
	{
		IStream* cliStream ;
		HRESULT hr = pStream->Clone(&cliStream);
		if(hr == S_OK)
		{
			//etc
		}
	}
}




The problem is that the Clone method is returning E_NOT_IMPL. So I'm thinking about creating class that inherits from IStream and implements the Clone method ... but still belive there is easier way to solve the problem.

Anyone can help ??
Posted
Updated 25-Oct-12 4:43am
v3
Comments
Sergey Alexandrovich Kryukov 25-Oct-12 14:36pm    
Well, why would you want it? It does not seem to be a good pattern. Always explain your ultimate goal, to get an adequate advice. Not many will waste time on answering if conceptually the goal is questionable.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900