⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 comsocketserver.idl

📁 这个动态链接库是Socket通过COm串口实现数据通信
💻 IDL
字号:
// COMSocketServer.idl : IDL source for COMSocketServer.dll
//

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

import "oaidl.idl";
import "ocidl.idl";
#include "JetByteTools\COMTools\AsyncServerEvent.idl"

	typedef enum ShutdownMethod
	{
		ShutdownRead,
		ShutdownWrite,
		ShutdownBoth	
	} ShutdownMethod;

	[
		object,
		uuid(FE3E6924-53EC-4E49-BB4B-226B4F3FF36D),
		dual,
		helpstring("IAddress Interface"),
		pointer_default(unique)
	]
	interface IAddress : IDispatch
	{
		[
			propget, 
			id(1), 
			helpstring("property Address")
		]
		HRESULT Address(
			[out, retval] BSTR *pVal);
		
		[
			propget, 
			id(2), 
			helpstring("property Port")
		]
		HRESULT Port(
			[out, retval] long *pVal);
	};

	[
		object,
		uuid(BA0080EA-9B07-4315-AC64-6FE62F3069B2),
		dual,
		helpstring("ISocket Interface"),
		pointer_default(unique)
	]
	interface ISocket : IDispatch
	{
		[
			id(1), 
			helpstring("method WriteString")
		] 
		HRESULT WriteString(
			[in] BSTR data,
			[in, optional] VARIANT sendAsUNICODE,
			[in, optional] VARIANT thenShutdown);

		[
			id(2), 
			helpstring("method Write")
		]
		HRESULT Write(
			[in] VARIANT arrayOfBytes,
			[in, optional] VARIANT thenShutdown);

		[
			id(3), 
			helpstring("method RequestRead")
		]
		HRESULT RequestRead();

		[
			propget, 
			id(4), 
			helpstring("property RemoteAddress")
		]
		HRESULT RemoteAddress(
			[out, retval] IAddress **ppVal);
		
		[
			id(5), 
			helpstring("method Shutdown")
		]
		HRESULT Shutdown(
			[in] ShutdownMethod how);

		[
			id(6), 
			helpstring("method Close")
		]
		HRESULT Close();
		
		[
			propget, 
			id(7), 
			helpstring("property UserData")
		] 
		HRESULT UserData(
			[out, retval] VARIANT *pVal);
		
		[
			propput, 
			id(7), 
			helpstring("property UserData")
		]
		HRESULT UserData(
			[in] VARIANT newVal);
	};


	[
		object,
		uuid(F064AF8E-20F7-4700-9916-30AD633D607C),
		dual,
		helpstring("IData Interface"),
		pointer_default(unique)
	]
	interface IData : IDispatch
	{
		[
			id(1), 
			helpstring("method ReadString")
		] 
		HRESULT ReadString(
			[out, retval] BSTR *pResults);
		
		[
			id(2), 
			helpstring("method Read")
		] 
		HRESULT Read(
			[out, retval] VARIANT *ppResults);
	};

	[
		object,
		uuid(8169BB59-E83F-4417-809B-FE7027F2C96D),
		dual,
		helpstring("IServer Interface"),
		pointer_default(unique)
	]
	interface IServer : IDispatch
	{
		[
			propget, 
			id(1), 
			helpstring("property LocalAddress")
		] 
		HRESULT LocalAddress(
			[out, retval] IAddress **ppVal);
		
		[
			id(2), 
			helpstring("method StartListening")
		] 
		HRESULT StartListening();

		[
			id(3), 
			helpstring("method StopListening")
		] 
		HRESULT StopListening();

	};

	[
		object,
		uuid(76F99A6B-1BF0-4851-949A-2DD19961554A),
		dual,
		helpstring("ISocketServerFactory Interface"),
		pointer_default(unique)
	]
	interface ISocketServerFactory : IDispatch
	{
		[
			id(1), 
			helpstring("method CreateSocketServer")
		]
		HRESULT CreateSocketServer(
			[in] long port, 
			[in, optional] VARIANT Address,
			[out, retval] IServer **ppServer);
	};

[
	uuid(A266F5D8-8C2D-46D9-A369-81AE1271F31E),
	version(1.0),
	helpstring("JetByte Socket Server 1.0 Type Library")
]
library JBSOCKETSERVERLib
{
	importlib("stdole32.tlb");
	importlib("stdole2.tlb");

	[
		uuid(0BA40530-19A8-4D1B-9E38-563862B2B590),
		helpstring("_IServerEvents Interface")
	]
	dispinterface _IServerEvents
	{
		properties:
		methods:
		[
			id(1), 
			helpstring("method OnConnectionEstablished")
		] 
		HRESULT OnConnectionEstablished(
			[in] ISocket *Socket);
		
		[
			id(2), 
			helpstring("method OnDataReceived")
		]
		HRESULT OnDataReceived(
			[in] ISocket *Socket, 
			[in] IData *Data);

		[
			id(3), 
			helpstring("method OnConnectionClosed")
		]
		HRESULT OnConnectionClosed(
			[in] ISocket *Socket);
	};

	[
		uuid(C3814C1D-516D-4DD2-828E-46C3FD056F46),
		helpstring("Server Class"),
		noncreatable
	]
	coclass Server
	{
		[default] interface IServer;
		[default, source] dispinterface _IServerEvents;
	};

	[
		uuid(1A4E381B-A11B-4E5B-8B56-B62C9997070F),
		helpstring("Socket Class"),
		noncreatable
	]
	coclass Socket
	{
		[default] interface ISocket;
	};
	[
		uuid(C361B25D-8257-4876-90E5-0FF753206D5F),
		helpstring("Address Class"),
		noncreatable
	]
	coclass Address
	{
		[default] interface IAddress;
	};
	[
		uuid(4899525C-7605-4F3E-AD85-AD584C7A8867),
		helpstring("Data Class"),
		noncreatable
	]
	coclass Data
	{
		[default] interface IData;
	};
	[
		uuid(2A1C60A2-F466-40F7-A19B-378ABA16D729),
		helpstring("Socket Server Factory Class"),
		appobject
	]
	coclass SocketServerFactory
	{
		[default] interface ISocketServerFactory;
	};
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -