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
This commit is contained in:
@@ -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.
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user