From 27d7687903b04c56878597fefccf3daafd0a58fa Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 26 Nov 2010 13:30:25 +0000 Subject: [PATCH] No real changes, just use ProgID term instead of incorrect CLSID. CLSID was used instead of ProgID in several places in the code and the documentation but they are different things so clear up the confusion. See #12489. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66261 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/ole/automtn.h | 6 +++--- interface/wx/msw/ole/automtn.h | 13 +++++++------ src/msw/ole/automtn.cpp | 22 +++++++++++----------- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/include/wx/msw/ole/automtn.h b/include/wx/msw/ole/automtn.h index 41db577284..7ea70f8e4c 100644 --- a/include/wx/msw/ole/automtn.h +++ b/include/wx/msw/ole/automtn.h @@ -43,11 +43,11 @@ public: bool IsOk() const { return m_dispatchPtr != NULL; } // Get a dispatch pointer from the current object associated - // with a class id, such as "Excel.Application" - bool GetInstance(const wxString& classId) const; + // with a ProgID, such as "Excel.Application" + bool GetInstance(const wxString& progId) const; // Get a dispatch pointer from a new instance of the the class - bool CreateInstance(const wxString& classId) const; + bool CreateInstance(const wxString& progId) const; // Low-level invocation function. Pass either an array of variants, // or an array of pointers to variants. diff --git a/interface/wx/msw/ole/automtn.h b/interface/wx/msw/ole/automtn.h index 9e0359177b..397703cbe8 100644 --- a/interface/wx/msw/ole/automtn.h +++ b/interface/wx/msw/ole/automtn.h @@ -75,11 +75,11 @@ public: //@} /** - Creates a new object based on the class id, returning @true if the object was + Creates a new object based on the ProgID, returning @true if the object was successfully created, or @false if not. */ - bool CreateInstance(const wxString& classId) const; + bool CreateInstance(const wxString& progId) const; /** Checks if the object is in a valid state. @@ -100,16 +100,17 @@ public: void* GetDispatchPtr() const; /** - Retrieves the current object associated with a class id, and attaches the - IDispatch pointer - to this object. Returns @true if a pointer was successfully retrieved, @false + Retrieves the current object associated with the specified ProgID, and + attaches the IDispatch pointer to this object. + + Returns @true if a pointer was successfully retrieved, @false otherwise. Note that this cannot cope with two instances of a given OLE object being active simultaneously, such as two copies of Excel running. Which object is referenced cannot currently be specified. */ - bool GetInstance(const wxString& classId) const; + bool GetInstance(const wxString& progId) const; /** Retrieves a property from this object, assumed to be a dispatch pointer, and diff --git a/src/msw/ole/automtn.cpp b/src/msw/ole/automtn.cpp index 9ab7f7897c..f047bda3d4 100644 --- a/src/msw/ole/automtn.cpp +++ b/src/msw/ole/automtn.cpp @@ -490,8 +490,8 @@ bool wxAutomationObject::GetObject(wxAutomationObject& obj, const wxString& prop } // Get a dispatch pointer from the current object associated -// with a class id -bool wxAutomationObject::GetInstance(const wxString& classId) const +// with a ProgID +bool wxAutomationObject::GetInstance(const wxString& progId) const { if (m_dispatchPtr) return false; @@ -500,12 +500,12 @@ bool wxAutomationObject::GetInstance(const wxString& classId) const CLSID clsId; IUnknown * pUnk = NULL; - wxBasicString unicodeName(classId); + wxBasicString unicodeName(progId); hr = CLSIDFromProgID((BSTR) unicodeName, &clsId); if (FAILED(hr)) { - ShowException(classId, hr, NULL, 0); + ShowException(progId, hr, NULL, 0); wxLogWarning(wxT("Cannot obtain CLSID from ProgID")); return false; } @@ -513,7 +513,7 @@ bool wxAutomationObject::GetInstance(const wxString& classId) const hr = GetActiveObject(clsId, NULL, &pUnk); if (FAILED(hr)) { - ShowException(classId, hr, NULL, 0); + ShowException(progId, hr, NULL, 0); wxLogWarning(wxT("Cannot find an active object")); return false; } @@ -521,7 +521,7 @@ bool wxAutomationObject::GetInstance(const wxString& classId) const hr = pUnk->QueryInterface(IID_IDispatch, (LPVOID*) &m_dispatchPtr); if (FAILED(hr)) { - ShowException(classId, hr, NULL, 0); + ShowException(progId, hr, NULL, 0); wxLogWarning(wxT("Cannot find IDispatch interface")); return false; } @@ -530,8 +530,8 @@ bool wxAutomationObject::GetInstance(const wxString& classId) const } // Get a dispatch pointer from a new object associated -// with the given class id -bool wxAutomationObject::CreateInstance(const wxString& classId) const +// with the given ProgID +bool wxAutomationObject::CreateInstance(const wxString& progId) const { if (m_dispatchPtr) return false; @@ -539,12 +539,12 @@ bool wxAutomationObject::CreateInstance(const wxString& classId) const HRESULT hr; CLSID clsId; - wxBasicString unicodeName(classId); + wxBasicString unicodeName(progId); hr = CLSIDFromProgID((BSTR) unicodeName, &clsId); if (FAILED(hr)) { - ShowException(classId, hr, NULL, 0); + ShowException(progId, hr, NULL, 0); wxLogWarning(wxT("Cannot obtain CLSID from ProgID")); return false; } @@ -558,7 +558,7 @@ bool wxAutomationObject::CreateInstance(const wxString& classId) const (void**)&m_dispatchPtr); if (FAILED(hr)) { - ShowException(classId, hr, NULL, 0); + ShowException(progId, hr, NULL, 0); wxLogWarning(wxT("Could not start an instance of this class.")); return false; } -- 2.47.2