Update of /cvsroot/pywin32/pywin32/com/win32comext/axcontrol/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7708/src
Modified Files:
AXControl.cpp PyIOleInPlaceSite.cpp PyIOleObject.cpp
Log Message:
More ActiveX control work, and a demo of an enbedded IE control without
resorting to MFC/Pythonwin
Index: PyIOleObject.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axcontrol/src/PyIOleObject.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** PyIOleObject.cpp 4 Jun 2000 05:57:04 -0000 1.3
--- PyIOleObject.cpp 12 Oct 2007 00:36:12 -0000 1.4
***************
*** 269,283 ****
LONG lindex;
HWND hwndParent;
! MSG msg;
! LPMSG lpmsg = &msg;
RECT rect;
LPCRECT lprcPosRect = ▭
! if ( !PyArg_ParseTuple(args, "iOii(iiii):DoVerb", &iVerb, &obpActiveSite, &lindex, &hwndParent,
&rect.left, &rect.top, &rect.right, &rect.bottom) )
return NULL;
! //PyObject *arglst = Py_BuildValue("((iiiii(ii)))",msg->hwnd,msg->message,msg->wParam,msg->lParam,msg->time,msg->pt.x,msg->pt.y);
! // TODO Handle Message Structure
! lpmsg = NULL;
BOOL bPythonIsHappy = TRUE;
--- 269,285 ----
LONG lindex;
HWND hwndParent;
! MSG msg, *lpmsg = NULL;
! PyObject *obMsg;
RECT rect;
LPCRECT lprcPosRect = ▭
! if ( !PyArg_ParseTuple(args, "iOOii(iiii):DoVerb", &iVerb, &obMsg, &obpActiveSite, &lindex, &hwndParent,
&rect.left, &rect.top, &rect.right, &rect.bottom) )
return NULL;
! if (obMsg != Py_None) {
! lpmsg = &msg;
! if (!PyWinObject_AsMSG(obMsg, &msg))
! return NULL;
! }
BOOL bPythonIsHappy = TRUE;
Index: AXControl.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axcontrol/src/AXControl.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** AXControl.cpp 13 Feb 2006 12:20:40 -0000 1.6
--- AXControl.cpp 12 Oct 2007 00:36:12 -0000 1.7
***************
*** 292,295 ****
--- 292,323 ----
}
+ // @pymethod |axcontrol|OleSetContainedObject|Notifies an object embedded in an OLE container to ensure correct reference.
+ static PyObject *axcontrol_OleSetContainedObject(PyObject *, PyObject *args)
+ {
+ PyObject *ret = NULL;
+ PyObject *obunk;
+ int fContained;
+ if (!PyArg_ParseTuple(args, "Oi",
+ &obunk, // @pyparm <o PyIUnknown>|unk||The object
+ &fContained)) // @pyparm int|fContained||
+ return NULL;
+
+ IUnknown *punk = NULL;
+ HRESULT hr;
+ if (!PyCom_InterfaceFromPyInstanceOrObject(obunk, IID_IUnknown, (void **)&punk, FALSE))
+ goto done;
+
+ Py_BEGIN_ALLOW_THREADS
+ hr = ::OleSetContainedObject(punk, fContained);
+ Py_END_ALLOW_THREADS
+ if (FAILED(hr)) {
+ PyCom_BuildPyException(hr);
+ goto done;
+ }
+ ret = Py_None;
+ Py_INCREF(Py_None);
+ done:
+ return ret;
+ }
***************
*** 301,304 ****
--- 329,335 ----
{ "OleLoadPicture", axcontrol_OleLoadPicture, 1 }, // @pymeth OleLoadPicture|Creates a new picture object and initializes it from the contents of a stream.
{ "OleLoadPicturePath", axcontrol_OleLoadPicturePath, 1}, // @pymeth OleLoadPicturePath|Creates a new picture object and initializes it from the contents of a stream.
+ { "OleSetContainedObject", axcontrol_OleSetContainedObject, 1}, // @pymeth OleSetContainedObject|Notifies an object embedded in an OLE container to ensure correct reference.
+
+
{ NULL, NULL },
};
***************
*** 363,365 ****
--- 394,408 ----
ADD_CONSTANT(OLECMDF_NINCHED); // @const axcontrol|OLECMDF_NINCHED|
+ ADD_CONSTANT(OLEIVERB_PRIMARY);
+ ADD_CONSTANT(OLEIVERB_SHOW);
+ ADD_CONSTANT(OLEIVERB_OPEN);
+ ADD_CONSTANT(OLEIVERB_HIDE);
+ ADD_CONSTANT(OLEIVERB_UIACTIVATE);
+ ADD_CONSTANT(OLEIVERB_INPLACEACTIVATE);
+ ADD_CONSTANT(OLEIVERB_DISCARDUNDOSTATE);
+ ADD_CONSTANT(EMBDHLP_INPROC_HANDLER);
+ ADD_CONSTANT(EMBDHLP_INPROC_SERVER);
+ ADD_CONSTANT(EMBDHLP_CREATENOW);
+ ADD_CONSTANT(EMBDHLP_DELAYCREATE);
+ ADD_CONSTANT(OLECREATE_LEAVERUNNING);
}
Index: PyIOleInPlaceSite.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axcontrol/src/PyIOleInPlaceSite.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PyIOleInPlaceSite.cpp 1 Sep 1999 23:05:44 -0000 1.1
--- PyIOleInPlaceSite.cpp 12 Oct 2007 00:36:12 -0000 1.2
***************
*** 312,331 ****
if (ppDoc==NULL) return E_POINTER;
PyObject *result;
! HRESULT hr=InvokeViaPolicy("GetWindowContext", &result, "");
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
PyObject *obppFrame;
PyObject *obppDoc;
! PyObject *obNone;
! if (!PyArg_ParseTuple(result, "OO(llll)(llll)O" , &obppFrame, &obppDoc,
&lprcPosRect->left, &lprcPosRect->top, &lprcPosRect->right, &lprcPosRect->bottom,
&lprcClipRect->left, &lprcClipRect->top, &lprcClipRect->right, &lprcClipRect->bottom,
! &obNone))
return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/);
BOOL bPythonIsHappy = TRUE;
if (!PyCom_InterfaceFromPyInstanceOrObject(obppFrame, IID_IOleInPlaceFrame, (void **)ppFrame, TRUE /* bNoneOK */))
! bPythonIsHappy = FALSE;
if (!PyCom_InterfaceFromPyInstanceOrObject(obppDoc, IID_IOleInPlaceUIWindow, (void **)ppDoc, TRUE /* bNoneOK */))
! bPythonIsHappy = FALSE;
if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/);
Py_DECREF(result);
--- 312,336 ----
if (ppDoc==NULL) return E_POINTER;
PyObject *result;
! HRESULT hr=InvokeViaPolicy("GetWindowContext", &result);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
PyObject *obppFrame;
PyObject *obppDoc;
! PyObject *obFrame;
! PyObject *obAccel;
! if (!PyArg_ParseTuple(result, "OO(llll)(llll)(iOOi)" , &obppFrame, &obppDoc,
&lprcPosRect->left, &lprcPosRect->top, &lprcPosRect->right, &lprcPosRect->bottom,
&lprcClipRect->left, &lprcClipRect->top, &lprcClipRect->right, &lprcClipRect->bottom,
! &lpFrameInfo->fMDIApp, &obFrame, &obAccel, &lpFrameInfo->cAccelEntries))
return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/);
BOOL bPythonIsHappy = TRUE;
if (!PyCom_InterfaceFromPyInstanceOrObject(obppFrame, IID_IOleInPlaceFrame, (void **)ppFrame, TRUE /* bNoneOK */))
! bPythonIsHappy = FALSE;
if (!PyCom_InterfaceFromPyInstanceOrObject(obppDoc, IID_IOleInPlaceUIWindow, (void **)ppDoc, TRUE /* bNoneOK */))
! bPythonIsHappy = FALSE;
! if (bPythonIsHappy && !PyWinObject_AsHANDLE(obFrame, (HANDLE *)&lpFrameInfo->hwndFrame))
! bPythonIsHappy = FALSE;
! if (bPythonIsHappy && !PyWinObject_AsHANDLE(obAccel, (HANDLE *)&lpFrameInfo->haccel))
! bPythonIsHappy = FALSE;
if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/);
Py_DECREF(result);
***************
*** 377,381 ****
{
PY_GATEWAY_METHOD;
! HRESULT hr=InvokeViaPolicy("OnPosRectChange", NULL, "(llll)", pr->left, pr->top, pr->right, pr->bottom);
return hr;
}
--- 382,386 ----
{
PY_GATEWAY_METHOD;
! HRESULT hr=InvokeViaPolicy("OnPosRectChange", NULL, "((llll))", pr->left, pr->top, pr->right, pr->bottom);
return hr;
}
|