Python Wrapper for C# Com Object

bg_ie at yahoo.com bg_ie at yahoo.com
Thu Dec 28 04:12:58 EST 2006


Hi,

I wish to write a Python wrapper for my C# COM object but am unsure
where to start. I have a dll and a tlb file, and I can use this object
in C via the following code -

// ConsolApp.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "windows.h"
#include "stdio.h"
#import "C:\Documents and Settings\X\Mina dokument\Visual Studio
2005\Projects\X_COMObject\X_COMObject\bin\Debug\X_COMObject.tlb"
using namespace X_COMObject;

int _tmain(int argc, _TCHAR* argv[])
{
	CoInitialize(NULL);

	X_COMObject::XCOM_InterfacePtr p(__uuidof(X_COMObject::XCOM_Class));
	XCOM_Interface *X_com_ptr ;
	X_com_ptr = p ;
	X_com_ptr->SetID(10);
	int x = X_com_ptr->GetID();
	printf("%d",x);
	getchar();

	return 0;
}

Can anyone offer me some tips as to how to do this in Python?

Thanks very much for your help,

Barry.




More information about the Python-list mailing list