I am trying to get create a stream between an executable on the PC and
one on the handheld device using the IPMConnection::CreateStream()
function. I was following the "How to Create Remote Tools for Windows CE
.NET" guide in MSDN and using the Remote Time Viewer test app as a
reference. However the guide says TimeViewer is using IPMConnection but
it isn't, at least the version I have isn't; rather it uses IConnection.
There seems to be 2 similar hierarchies of interfaces defined in
cemgr.h, IRemoteDevice vs IPMRemoteDevice, IConnection vs IPMConnection etc.

They differ in minor ways, so for example IPMPlatformManager has a
GetPlatform where you can pass the name, but IPlatformManager only has
one for the GUID, so to search it by name you have to enumerate the
platforms and ask each their name.

Anyway, IConnection::CreateStream() takes the stream GUID as an actual
GUID but IPMConnection::CreateStream() takes it as a BSTR - "bstrHostId
[in] GUID of the host. "

I wasn't sure how I was supposed to pass the GUID as a BSTR, so I tried
doing it like this:


// {1B140018-0ABD-4b4e-99B8-8F8A635F4BB3}
DEFINE_GUID(CeRunnerStreamGuid,
0x1b140018, 0xabd, 0x4b4e, 0x99, 0xb8, 0x8f, 0x8a, 0x63, 0x5f, 0x4b, 0xb3);

#define CeRunnerStreamGuidAsStr L"1B140018-0ABD-4b4e-99B8-8F8A635F4BB3"

...
IPMConnectionStream *piIPMConnectionStream = 0;
BSTR bstrGuid = SysAllocString(CeRunnerStreamGuidAsStr);
hr = piIPMConnection->CreateStream(bstrGuid, 0, piIPMConnectionStream);
if (FAILED(hr))
{
wcerr << L"Failed to create stream " << hr << endl;
return -1;
}


Unsurprisingly, I get an HRESULT back of 0x80070057 "The parameter is
incorrect.", so clearly this isn't the right way to do it.

Could someone explain to me what the correct way to do this is?

Why are there 2 similar sets of interfaces in cemgr.h?

Also, since TimeViewer uses the Ix rather than IPMx interfaces, does
that mean the example code in the TimeViewerCe.exe to create the
device-end of the stream won't work if I create the stream on the PC-end
using IPMConnection?

Thanks in advance,
Dave