Not getting Excel::_ApplicationPtr from WindowsPtr.
C / C++ / MFC
1
Posts
1
Posters
0
Views
1
Watching
-
Hi, I am working on Excel Automation. Implemented the logic to retrieve all the running Excel instances, now I am getting IDispatch pointer. Assigning this IDispatch Pointer to Excel object. Following is the code: IDispatch* p=NULL; HRESULT hr = AccessibleObjectFromWindow(hwnd, OBJID_WINDOW, __uuidof(IDispatch), (void**)&p); if(hr == S_OK) { try { Excel::WindowsPtr pWindow = NULL; HRESULT hr = p->QueryInterface(__uuidof(IDispatch),(void**)&pWindow); Excel::_ApplicationPtr xl; xl = pWindow->Application; But its throwing exception at above line. The com error is: m_hresult is "Member not found". I googled but there is no clarity in solution. If any clue, please let me know. Thanks in Advance. Regards, KTTransfer.