component.idl

来自「经验交流,从网上下载的好东西望大家分享」· IDL 代码 · 共 77 行

IDL
77
字号
// component.idl
/* Bug in MIDL: Comment out the three references to _maxcount_test in the component_p.c file */
import "unknwn.idl";

[ object, uuid(10000111-0000-0000-0000-000000000001) ]
interface ITest : IUnknown
{
	// pointer to one integer
	HRESULT SquareInteger([in] int myInteger, [out] int* square);

	// fixed array
	HRESULT SumOfIntegers1([in] int myIntegers[5], [out] int* sum);

	// conformant array
	HRESULT SumOfIntegers2([in] int cMax, [in, size_is(cMax)] int* myIntegers, [out] int* sum);

	// conformant array in a structure
	typedef struct tagSUM_STRUCT
	{
		int cMax;
		[size_is(cMax)] int* myIntegers;
	} SUM_STRUCT;
	HRESULT SumOfIntegers3([in] SUM_STRUCT* myIntegers, [out] int* sum);

	// varying array
	HRESULT SumOfIntegers4([in] int cFirst, [in] int cActual, [in, first_is(cFirst), length_is(cActual)] int* myIntegers[7], [out] int* sum);

	// conformant array with out parameter
	HRESULT ProduceIntegers1([in] int cMax, [out, size_is(cMax)] int* myIntegers);

	// varying array
	HRESULT ProduceIntegers2([out] int* pcActual, [out, length_is(*pcActual)] int myIntegers[4096]);

	// varying array with in, out parameter
	HRESULT SendReceiveIntegers([in, out] int* pcActual, [in, out, length_is(*pcActual)] int myIntegers[4096]);

	// open array
	HRESULT ProduceIntegers3([in] int cMax, [out] int* pcActual, [out, size_is(cMax), length_is(*pcActual)] int* myIntegers);

	// conformant array of characters
	HRESULT SendString1([in] int cLength, [in, size_is(cLength)] wchar_t* myString);

	// string attribute
	HRESULT SendString2([in, string] wchar_t* myString);
	
	// string in, out
	HRESULT SendReceiveString1([in, out, string] wchar_t* myString);

	// string in, out with maximum
	HRESULT SendReceiveString2([in] int cMax, [in, out, string, size_is(cMax)] wchar_t* myString);

	// dynamic string size on both sides
	HRESULT SendReceiveString3([in, out, string] wchar_t** myString);

	// a pointer to a pointer to one integer
	HRESULT SendInteger([in] int** test);

	// multidimensional arrays
	HRESULT SendIntegers1([in, size_is(, 2)] int** test);
	HRESULT SendIntegers2([in, size_is(3, )] int** test);
	HRESULT SendIntegers3([in, size_is(3, 2)] int** test);
}

[ uuid(10000333-0000-0000-0000-000000000001),
  helpstring("IDL Test Component Type Library"),
  version(1.0) ]
library Component
{
	importlib("stdole32.tlb");
	interface ITest;

	[ uuid(10000222-0000-0000-0000-000000000001) ]
	coclass TestIDL
	{
		interface ITest;
	}
};

⌨️ 快捷键说明

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