Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
G

gtag

@gtag
About
Posts
46
Topics
19
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to get clsid from GUID of a class
    G gtag

    Hi All, Can you help me to get clsid from GUID. I tried in google. didn't find. I'm new to cpp. Thanks in advance..

    C / C++ / MFC c++ help tutorial

  • Regarding SheetCalculate event in Excel API
    G gtag

    Using Excel object library, I have written an application which capture all events. I have an issue in event called SheetCalculate. SheetCalcuate event returns IDispatch*. From IDispatch* , I am trying to get sheet name or function cell change for which event is triggered. Please guide me if any one worked on this. Thanks in advance.

    COM json help tutorial

  • Getting Excel sheet names
    G gtag

    Hi stuart, I have one more issue. My application works fine for Office 2007. For office 2003, AfterCalculate is not triggering. Googled, in msdn got the clue that it is new in 2007 and its not available in 2003. If you have any idea, please let me know. Thanks in advance. Regards, gtag

    COM learning

  • Win Service is not accessing desktop application
    G gtag

    I have written windows service in C++ using winsvc.h. Registering the exe to run as service. Service runs under "SYSTEM" credentials and it starts at system startup. Using this service I can able to access processes only which are running under "SYSTEM". Is there any property or method related to service in WinSvc.h while creating or starting service, which is used to set the service to access any process running on the desktop. I can set this manually in services.msc for particular service under log on tab in properties. But want to set it programmatically. I tried checking many blogs and googled but there is no clue. Please give me clue. Thanks in advance. Regards, Gtag.

    C / C++ / MFC c++

  • Getting Excel sheet names
    G gtag

    Hi, I checked your post in C/C++ related to events. Its really helpful. Thank you once again. Gtag

    COM learning

  • Getting Excel sheet names
    G gtag

    Hi stuart, Thanks again. I corrected, its working perfectly. One more help I need, I just want to know , is there any documentation on excel for programming in C++ , I have checked msdn, codeproject, there are only basic things related to excel not at events level. If there are any, please provide me the link where I get the info. Or if you have any such stuff on excel(writing excel events etc), please let me know. Regards, Gtag

    COM learning

  • Getting Excel sheet names
    G gtag

    Hi Stuart, Thanks again. But I am not getting name its failing at getting sheets from the workbook to which I am pointing. Main aim is to get the workbook names and worksheets names opened by the user, might be 50 workbooks or any number. Please check the code and let me know where I am doing wrong? //MicroSoft Office Objects #import \ "C:\Program Files\Common Files\Microsoft Shared\OFFICE11\mso.dll" \ rename("DocumentProperties", "DocumentPropertiesXL") \ rename("RGB", "RBGXL") //Microsoft VBA Objects #import \ "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\vbe6ext.olb" using namespace Office; //Excel Application Objects #import "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" \ rename("DialogBox", "DialogBoxXL") rename("RGB", "RBGXL") \ rename("DocumentProperties", "DocumentPropertiesXL") \ rename("ReplaceText", "ReplaceTextXL") \ rename("CopyFile", "CopyFileXL") \ exclude("IFont", "IPicture") no_dual_interfaces using namespace std; #include <string> int _tmain() {      Excel::_ApplicationPtr XL;      Excel::WorkbooksPtr book;      Excel::WorksheetsPtr sheet;           string BookName;      string SheetName;           int BookCount;      int SheetCount;      string bookArray[20];      int count; //A try block is used to trap any errors in communication try { //Initialise COM interface CoInitialize(NULL); HRESULT hr = XL.GetActiveObject(L"Excel.Application"); if(SUCCEEDED(hr)) {      book = XL->Workbooks;      BookCount = book->Count;      for(int i=1;i<=BookCount;i++)      {      BookName = book->Item[i]->Name;      cout<<BookName<<endl;      SheetCount = book->Item[i]->Sheets->Count;      for(int j=1;j<SheetCount;j++)      {           sheet = book->Item[i]->GetWorksheets();           if(sheet)           {                Excel::_

    COM learning

  • Getting Excel sheet names
    G gtag

    Hi, I am using following imports: //Mircorsoft Office Objects #import \       "C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE12\mso.dll"\       rename("DocumentProperties", "DocumentPropertiesXL")\       rename("RGB", "RBGXL") //Microsoft VBA Objects #import \       "C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA6\vbe6ext.olb" //Excel Application Objects using namespace Office; #import "C:\Program Files (x86)\Microsoft Office\Office12\EXCEL.EXE"\       rename("DialogBox", "DialogBoxXL") rename("RGB", "RBGXL")\       rename("DocumentProperties", "DocumentPropertiesXL")\       rename("ReplaceText", "ReplaceTextXL")\       rename("CopyFile", "CopyFileXL")\       exclude("IFont", "IPicture") no_dual_interfaces Excel::_ApplicationPtr XL; Excel::_WorkbookPtr book; Excel::_WorksheetPtr sheet; By using for loop ,able to get all workbook names.Using following code iterating through item, getting all workbook names. book = XL->Workbooks->Item[1]; In case of worksheet, i am not getting the name of worksheet.There is no such option as workbook. Able to point to particular sheet, but name option is not there. sheet = XL->Workbooks->Item[1]->Sheets->Item[1]; I want to retrieve whole list of worksheets present in workbook. Googled but I didn't get any clue. If there is any option, please give me clue. Thanks in advance. Gtag.

    COM learning

  • expression cannot be evaluated:0x0046d5b0 _com_error
    G gtag

    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.

    COM com debugging help question learning

  • How to get list of worksheet names using VC++ [modified]
    G gtag

    I am using following imports: //Mircorsoft Office Objects #import \      "C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE12\mso.dll"\      rename("DocumentProperties", "DocumentPropertiesXL")\      rename("RGB", "RBGXL") //Microsoft VBA Objects #import \      "C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA6\vbe6ext.olb" //Excel Application Objects using namespace Office; #import "C:\Program Files (x86)\Microsoft Office\Office12\EXCEL.EXE"\      rename("DialogBox", "DialogBoxXL") rename("RGB", "RBGXL")\      rename("DocumentProperties", "DocumentPropertiesXL")\      rename("ReplaceText", "ReplaceTextXL")\      rename("CopyFile", "CopyFileXL")\      exclude("IFont", "IPicture") no_dual_interfaces Excel::_ApplicationPtr XL; Excel::_WorkbookPtr book; Excel::_WorksheetPtr sheet; By using for loop ,able to get all workbook names.Using following code iterating through item, getting all workbook names. book = XL->Workbooks->Item[1]; In case of worksheet, i am not getting the name of worksheet.There is no such option as workbook. Able to point to particular sheet, but name option is not there. sheet = XL->Workbooks->Item[1]->Sheets->Item[1]; I want to retrieve whole list of worksheets present in workbook. Googled but I didn't get any clue. If there is any option, please give me clue. Thanks in advance. Gtag. Hey if any one knows, please give me clue.

    modified on Tuesday, September 29, 2009 9:29 AM

    C / C++ / MFC c++ tutorial learning

  • expression cannot be evaluated:0x0046d5b0 _com_error
    G 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

    COM com debugging help question learning

  • expression cannot be evaluated:0x0046d5b0 _com_error
    G 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

    COM com debugging help question learning

  • expression cannot be evaluated:0x0046d5b0 _com_error
    G gtag

    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

    COM com debugging help question learning

  • expression cannot be evaluated:0x0046d5b0 _com_error
    G gtag

    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

    COM com debugging help question learning

  • expression cannot be evaluated:0x0046d5b0 _com_error
    G gtag

    I changed it , but same issue. Is there any other way? Regards, Gtag

    COM com debugging help question learning

  • expression cannot be evaluated:0x0046d5b0 _com_error
    G gtag

    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

    COM com debugging help question learning

  • expression cannot be evaluated:0x0046d5b0 _com_error
    G gtag

    Hi, Again I am here with new one. Following is the code , I am attaching the instance of excel to active excel. Excel::_ApplicationPtr XL;      Excel::_WorkbookPtr book;      string XLWBName; try      {      CoInitialize(NULL);      HRESULT hr = XL.GetActiveObject(_T("Excel.Application"));                book = XL->;Workbooks->;Item[1];           XLWBName = book->Name;                     return true;      }      catch(_com_error &error)      {           cout << "COM error"<< endl;             return false;      } I implemented this in two applications: In 1st application it is working perfectly , after coinitialize i kept the breakpoint then it is called 2 methods from comip.h 1st is:HRESULT GetActiveObject(const CLSID& rclsid) throw() 2nd is: HRESULT GetActiveObject(LPCWSTR clsidString) throw() In 2nd application it is not working and checked the sequence of methods calling from comip.h, its calling only one method that is : HRESULT GetActiveObject(LPCWSTR clsidString) throw() Checked the value of book and other instances: ((*(IUnknown*)(&(*(IDispatch*)(&*((book).m_pInterface)))))).__vfptr __vfptr = CXX0030: Error: expression cannot be evaluated [0] = 0x0046d5b0 _com_error::`scalar deleting destructor'(unsigned int) __vfptr = 0x004f5af4 const _com_error::`vftable' please give me clue where I am doing wrong or something need to be added? Regards, Gtag

    COM com debugging help question learning

  • Getting link error
    G gtag

    Hey its working. Now even functionality is working perfectly. There was some problem in previous old application, I resolved it. Thank you very much. Regards, Gtag

    COM help c++ question

  • Getting link error
    G gtag

    I am retrying the same thing, want to make sure that only bcoz of linker reference its not working or any other reason. Hey please suggest if you know any other way, I am ready to do R and D. Pleasee.

    COM help c++ question

  • Getting link error
    G gtag

    Hi, Thank you. I have removed from linker and removed #includes even. Project is building but basic functionality is not working. I can put this way: I have one VC++ application built on older version which includes macros and these macros functionality depend on some lib which uses comsupp.lib I guess. Now I have to add some function to read excel data which uses mso.dll and other libraries which I mentioned , these use comsuppw.lib. Both the things I need but if I am removing reference to comsupp.dll macros functionality is not working. Is there any way to make both the things working using single com dll. Thanks in advance. Regards, Gtag

    COM help c++ question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups