MCPcopy Create free account
hub / github.com/mhammond/pywin32 / pythoncom_RegisterActiveObject

Function pythoncom_RegisterActiveObject

com/win32com/src/PythonCOM.cpp:1080–1107  ·  view source on GitHub ↗

@pymethod int|pythoncom|RegisterActiveObject|Register an object as the active object for its class

Source from the content-addressed store, hash-verified

1078
1079// @pymethod int|pythoncom|RegisterActiveObject|Register an object as the active object for its class
1080static PyObject *pythoncom_RegisterActiveObject(PyObject *self, PyObject *args)
1081{
1082 DWORD dwflags=0, dwkey=0;
1083 HRESULT hr;
1084 CLSID clsid;
1085 PyObject *obclsid;
1086 PyObject *obunk;
1087 IUnknown *punk;
1088
1089 // @pyparm <o PyIUnknown>|obUnknown||The object to register.
1090 // @pyparm <o PyIID>|clsid||The CLSID for the object
1091 // @pyparm int|flags||Flags to use.
1092 if (!PyArg_ParseTuple(args, "OOi:RegisterActiveObject",
1093 &obunk,
1094 &obclsid,
1095 &dwflags)) return NULL;
1096
1097 if (!PyWinObject_AsIID(obclsid, &clsid)) return NULL;
1098 if (!PyCom_InterfaceFromPyInstanceOrObject(obunk, IID_IUnknown, (void **)&punk), FALSE) return NULL;
1099
1100 PY_INTERFACE_PRECALL;
1101 hr = RegisterActiveObject(punk, clsid, dwflags, &dwkey);
1102 punk->Release();
1103 PY_INTERFACE_POSTCALL;
1104 if (S_OK!=hr) return PyCom_BuildPyException(hr);
1105 return PyInt_FromLong(dwkey);
1106 // @rdesc The result is a handle which should be pass to <om pythoncom.RevokeActiveObject>
1107}
1108
1109// @pymethod |pythoncom|RevokeActiveObject|Ends an object�s status as active.
1110static PyObject *pythoncom_RevokeActiveObject(PyObject *self, PyObject *args)

Callers

nothing calls this directly

Calls 4

PyWinObject_AsIIDFunction · 0.85
PyCom_BuildPyExceptionFunction · 0.85
ReleaseMethod · 0.45

Tested by

no test coverage detected