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

📄 openobjects.h

📁 .net 方面的开发说明资料。
💻 H
字号:
// =====================================================
// Object Server
//
// Design and Implementation by Floris van den Berg
//
// Copyright (c) 2002 Pylon
// =====================================================

#ifndef OBJECTSERVER_H
#define OBJECTSERVER_H

#define DLL_CALLCONV __stdcall
#define _STL std

#ifdef OBJECTSERVER_EXPORTS
#define SERVER_API __declspec(dllexport)
#else
#define SERVER_API __declspec(dllimport)
#endif

#ifndef _WINDOWS_
#include <windows.h>
#endif

#ifndef _OBJBASE_H_
#include <objbase.h>
#endif

// ========================================================
// Forward references
// ========================================================

struct ObjectInfo;
struct IObject;

// ========================================================
// Function pointers to discover and create methods
// ========================================================

typedef void (DLL_CALLCONV *ObjectInitializeProc)();
typedef HRESULT (DLL_CALLCONV *ObjectCreateProc)(void **iif);

// ========================================================
// Information block for each object
// ========================================================

#pragma pack(push, 1)
struct ObjectInfo {
	GUID family;
	GUID guid;
	ObjectCreateProc create;
	void *extra;
};
#pragma pack(pop)

// ========================================================
// Base component GUIDs
// ========================================================

static const GUID GUID_OBJECT =
{ 0xed735269, 0xe3d5, 0x48f7, { 0x92, 0xe8, 0x32, 0x45, 0x3a, 0x15, 0x4d, 0x41 } };

static const GUID GUID_SERVICEMANAGER = 
{ 0x167002d3, 0x3aac, 0x49f9, { 0x9b, 0xad, 0x84, 0x2a, 0xfc, 0xec, 0x7f, 0x5d } };

static const GUID CLSID_SERVICE_REGISTERABLE = 
{ 0x769d9567, 0x1bc0, 0x4097, { 0xa1, 0xba, 0x70, 0x6e, 0x94, 0xdb, 0x82, 0x8b } };

static const GUID GUID_SERVICE_DLL = 
{ 0xe819a6e3, 0x62ae, 0x4f1d, { 0x93, 0x74, 0x4f, 0xd4, 0xea, 0x69, 0x7e, 0xdf } };

// ========================================================
// Service (finds and instantiates objects in some
// platform specific way. This needs to be reimplemented
// per supported OS.
// ========================================================

struct IService : public IUnknown {
	virtual HRESULT DLL_CALLCONV CreateInstance(GUID family, GUID guid, void **object) = 0;
	virtual bool DLL_CALLCONV ObjectExists(GUID family, GUID guid) = 0;
};

// ========================================================
// Interface for services where you can manually add components
// ========================================================

struct IServiceRegisterable : public IService {
	virtual bool DLL_CALLCONV RegisterComponent(GUID family, GUID guid, ObjectCreateProc proc) = 0;
};

// ========================================================
// Service Manager (finds and instantiates objects)
// ========================================================

struct IServiceManager : public IUnknown {
	virtual void Init() = 0;
	virtual HRESULT DLL_CALLCONV AddService(GUID guid, IService *service) = 0;
	virtual HRESULT DLL_CALLCONV RemoveService(GUID guid) = 0;
	virtual HRESULT DLL_CALLCONV GetService(GUID guid, void **iif) = 0;
    virtual HRESULT DLL_CALLCONV CreateInstance(GUID family, GUID guid, void **object) = 0;
	virtual bool DLL_CALLCONV ObjectExists(GUID family, GUID guid) = 0;
};

// ========================================================
// Service Manager Instantiator
// ========================================================

extern "C" {
	// ----------------------------------------------------------
	// Purpose: Instantiates the service manager
	// Usage  : The service manager is the object that you use
	//          to find (discover) other components and to
	//          instantiate them.
	// Notes  : None
	// ----------------------------------------------------------

	SERVER_API HRESULT DLL_CALLCONV GetServiceManager(void **iif);

	// ----------------------------------------------------------
	// Purpose: Registers a component into the registerable
	//          service of the service manager.
	// Usage  : None
	// Notes  : None
	// ----------------------------------------------------------

	SERVER_API bool DLL_CALLCONV EpRegisterComponent(GUID family, GUID id, ObjectCreateProc create);

	// ----------------------------------------------------------
	// Purpose: Converts a GUID to a string
	// Usage  : None
	// Notes  : None
	// ----------------------------------------------------------

	SERVER_API int DLL_CALLCONV EpStringFromGuid(char *result, CLSID clsid);
}

#endif

⌨️ 快捷键说明

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