Click here to Skip to main content
12,292,006 members (67,444 online)
Click here to Skip to main content

Stats

64.7K views
417 downloads
40 bookmarked
Posted

Bringing DCOM remoting functionality to Windows CE and .NET CF2.0

, 17 Apr 2006 CPOL
This article shows how to use DCOM on Windows CE 5.0. We will add full DCOM rich error information, and implement a DCOM interface between a Windows XP .NET 2.0 client and Windows CE DCOM server. With this code, it is possible to code .NET remoting alike functionality through DCOM interop.
////////////////////////////////////////////////////////////////////
//
//  Copyright (C) 2006 Werner Willemsens
//
////////////////////////////////////////////////////////////////////

// StarGate.idl : IDL source for StarGate
//

// This file will be processed by the MIDL tool to
// produce the type library (StarGate.tlb) and marshalling code.

import "oaidl.idl";
import "ocidl.idl";
// Remove the following line - which was added by the Wizard - to avoid
// compilation errors when building the proxy/stub DLL
// We don't need this IDL file anyway.
//import "atliface.idl";

[
	object,
	uuid(243FA577-CEC3-4FAC-A111-3F175BDDECA1),
	dual,
	nonextensible,
	helpstring("IGate Interface"),
	pointer_default(unique),
	oleautomation			// we promise that this interface is ole automation compatible
							// so that we can use type library (automation) marshalling
]
interface IGate : IDispatch
{
	[id(1), helpstring("method DialGate")] HRESULT DialGate([in] LONG Chevron);
	[id(2), helpstring("method CloseGate")] HRESULT CloseGate();
	[propget, id(3), helpstring("property IsOpen")] HRESULT IsOpen([out, retval] VARIANT_BOOL* pVal);
};

#ifdef UNDER_CE
/* Windows CE does not support Type Library Marshaling, so
   we need to make it a custom interface that can be Proxy/Stub Marshalled */
    [
	    object,
		uuid(8DC5953F-FBE6-4CF5-9FB5-4FF8A7B15530),
		dual,
		helpstring("_IGateEvents Interface"),
		pointer_default(unique)
    ]
	interface _IGateEvents : IDispatch
	{
//		properties:
//		methods:
			[id(1), helpstring("method Opened")] HRESULT Opened([in] VARIANT Destination);
	};
#endif //UNDER_CE

[
	uuid(C7A4D895-63CC-491E-872C-DE81339AFC5F),
	version(1.0),
	helpstring("StarGate 1.0 Type Library")
]
library StarGateLib
{
	importlib("stdole2.tlb");
	interface IDocHostUIHandlerDispatch;
	interface IAxWinAmbientDispatchEx;

#ifndef UNDER_CE
	[
		uuid(8DC5953F-FBE6-4CF5-9FB5-4FF8A7B15530),
		helpstring("_IGateEvents Interface")
	]
	dispinterface _IGateEvents
	{
		properties:
		methods:
			[id(1), helpstring("method Opened")] HRESULT Opened([in] BSTR Destination);
	};
#endif //UNDER_CE

	[
		uuid(995D31E4-7472-4DCF-8B3B-8AA34ADCAA63),
		helpstring("Gate Class")
	]
	coclass Gate
	{
		[default] interface IGate;
		[default, source] dispinterface _IGateEvents;
	};
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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

Share

About the Author

Werner Willemsens
Team Leader
Belgium Belgium
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160518.1 | Last Updated 17 Apr 2006
Article Copyright 2006 by Werner Willemsens
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid