expression cannot be evaluated:0x0046d5b0 _com_error
-
Is the second application compiled with Unicode turned on? Because your passing an LPCTSTR (which can be ASCII or Unicode, depending on pre-processor macro settings) to GetActiveObject, where you are meant to pass an LPCWSTR
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
Sorry I am new to this, I searched for this option, i didn't find it? Please tell me where I can find this option in Microsoft visual studio 2008(Professional edition). Regards, gtag
Don't worry too much about that - just make sure you use
L"Excel.Application"
instead of
_T("Excel.Application")
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
Don't worry too much about that - just make sure you use
L"Excel.Application"
instead of
_T("Excel.Application")
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
What HRESULT was returned from GetActiveObject? Was Excel running when you did the GetActiveObject call?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
What HRESULT was returned from GetActiveObject? Was Excel running when you did the GetActiveObject call?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
hr = 0x800401e3 Operation unavailable Excel was running. With other application I can attach with both option s _T or L. Even can read xlworksheet names and all. Regards, Gtag
gtag wrote:
hr = 0x800401e3 Operation unavailable
Right - well that explains why you weren't getting a pointer to the Excel application. Doing a quick Google (you know, like you could have done) brings up this MS support page[^] which deals with your scenario.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
gtag wrote:
hr = 0x800401e3 Operation unavailable
Right - well that explains why you weren't getting a pointer to the Excel application. Doing a quick Google (you know, like you could have done) brings up this MS support page[^] which deals with your scenario.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
Surely I will check out the blog u mentioned. After doing little analysis on both the applications I have got few inputs for not getting attached to active object, but solution I couldn't? Following are the functions called from comip.h HRESULT GetActiveObject(const CLSID& rclsid) throw() { _Release(); IUnknown* pIUnknown; HRESULT hr = ::GetActiveObject(rclsid, NULL, &pIUnknown); if (SUCCEEDED(hr)) { hr = pIUnknown->QueryInterface(GetIID(), reinterpret_cast<void**>(&m_pInterface)); pIUnknown->Release(); } if (FAILED(hr)) { // just in case refcount = 0 and dtor gets called m_pInterface = NULL; } return hr; } // Attach to the active object specified by clsidString. // First convert the LPCWSTR to a CLSID. // HRESULT GetActiveObject(LPCWSTR clsidString) throw() { if (clsidString == NULL) { return E_INVALIDARG; } CLSID clsid; HRESULT hr; if (clsidString[0] == '{') { hr = CLSIDFromString(const_cast<LPWSTR> (clsidString), &clsid); } else { &nb
-
Surely I will check out the blog u mentioned. After doing little analysis on both the applications I have got few inputs for not getting attached to active object, but solution I couldn't? Following are the functions called from comip.h HRESULT GetActiveObject(const CLSID& rclsid) throw() { _Release(); IUnknown* pIUnknown; HRESULT hr = ::GetActiveObject(rclsid, NULL, &pIUnknown); if (SUCCEEDED(hr)) { hr = pIUnknown->QueryInterface(GetIID(), reinterpret_cast<void**>(&m_pInterface)); pIUnknown->Release(); } if (FAILED(hr)) { // just in case refcount = 0 and dtor gets called m_pInterface = NULL; } return hr; } // Attach to the active object specified by clsidString. // First convert the LPCWSTR to a CLSID. // HRESULT GetActiveObject(LPCWSTR clsidString) throw() { if (clsidString == NULL) { return E_INVALIDARG; } CLSID clsid; HRESULT hr; if (clsidString[0] == '{') { hr = CLSIDFromString(const_cast<LPWSTR> (clsidString), &clsid); } else { &nb
Read the page I pointed you at. Don't bother digging through the Microsoft library code - the error is not in that.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
Surely I will check out the blog u mentioned. After doing little analysis on both the applications I have got few inputs for not getting attached to active object, but solution I couldn't? Following are the functions called from comip.h HRESULT GetActiveObject(const CLSID& rclsid) throw() { _Release(); IUnknown* pIUnknown; HRESULT hr = ::GetActiveObject(rclsid, NULL, &pIUnknown); if (SUCCEEDED(hr)) { hr = pIUnknown->QueryInterface(GetIID(), reinterpret_cast<void**>(&m_pInterface)); pIUnknown->Release(); } if (FAILED(hr)) { // just in case refcount = 0 and dtor gets called m_pInterface = NULL; } return hr; } // Attach to the active object specified by clsidString. // First convert the LPCWSTR to a CLSID. // HRESULT GetActiveObject(LPCWSTR clsidString) throw() { if (clsidString == NULL) { return E_INVALIDARG; } CLSID clsid; HRESULT hr; if (clsidString[0] == '{') { hr = CLSIDFromString(const_cast<LPWSTR> (clsidString), &clsid); } else { &nb
NO, I am getting same error value in hr. I am still trying. As I am mentioned in above , "_Release();" is not getting called. I checked in other app where it is working if I right click on _Release() and see the definition , nothing is reflecting overthere but when I did the same thing in current app(where its not working) , symbols are not loaded it is showing. Is this the issue? Regards, Gtag
-
NO, I am getting same error value in hr. I am still trying. As I am mentioned in above , "_Release();" is not getting called. I checked in other app where it is working if I right click on _Release() and see the definition , nothing is reflecting overthere but when I did the same thing in current app(where its not working) , symbols are not loaded it is showing. Is this the issue? Regards, Gtag
I tried the solution mentioned in the blog posted by u, but hr value I am getting same. Even intellisense is not working in comip.h. But it is working in other project. If you get any clue , then please let me know. Thanks in advance. Regards, GTag.
modified on Monday, September 21, 2009 5:24 AM
-
I tried the solution mentioned in the blog posted by u, but hr value I am getting same. Even intellisense is not working in comip.h. But it is working in other project. If you get any clue , then please let me know. Thanks in advance. Regards, GTag.
modified on Monday, September 21, 2009 5:24 AM
Hi Stuart, Thanks for helping me in this issue. Today I resolved the issue. It has to do with security, as my application is having service which runs under "System" user name and Excel runs under other login not system, so it was not accessing excel under other login. Now I am able to access active object. Thanks once again.