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
  1. Home
  2. General Programming
  3. COM
  4. DISP_E_UNKNOWNNAME from GetIDsOfNames

DISP_E_UNKNOWNNAME from GetIDsOfNames

Scheduled Pinned Locked Moved COM
c++
11 Posts 2 Posters 31 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    ForNow
    wrote on last edited by
    #1

    Hi, I getting the above return code the following is my code sequence

    CLSID clsid; // initialization
    HRESULT hr = CLSIDFromProgID(L"Excel.Application",&clsid)

    IDispatch *pWApp;

    hr = CoCreateInstance(clsid, NULL, CLSCTX\_LOCAL\_SERVER, 
                          IID\_IDispatch, (void \*\*)&pWApp);
    

    LPOLESTR ptName = (LPOLESTR) _T("OpenText");
    DISPID dispID;
    hr = pWApp->GetIDsOfNames(IID_NULL, &ptName, 1 , LOCALE_USER_DEFAULT,&dispID);

    I am using VIsual C++ 6.0 excel 2003 Thanks

    L 1 Reply Last reply
    0
    • F ForNow

      Hi, I getting the above return code the following is my code sequence

      CLSID clsid; // initialization
      HRESULT hr = CLSIDFromProgID(L"Excel.Application",&clsid)

      IDispatch *pWApp;

      hr = CoCreateInstance(clsid, NULL, CLSCTX\_LOCAL\_SERVER, 
                            IID\_IDispatch, (void \*\*)&pWApp);
      

      LPOLESTR ptName = (LPOLESTR) _T("OpenText");
      DISPID dispID;
      hr = pWApp->GetIDsOfNames(IID_NULL, &ptName, 1 , LOCALE_USER_DEFAULT,&dispID);

      I am using VIsual C++ 6.0 excel 2003 Thanks

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Check your return codes.

      F 1 Reply Last reply
      0
      • L Lost User

        Check your return codes.

        F Offline
        F Offline
        ForNow
        wrote on last edited by
        #3

        For CoInitialize I am getting a 0x00000001 S_FALSE (already initliazed) For CLSIDFromProgID I am getting a 0x00000000 S_OK For CoCreateInstance I am getting a 0x00000000 S_OK For GetIDsOfNames I am getting a 0X80020006 DISP_E_UNKNOWNNAME Thanks

        L 2 Replies Last reply
        0
        • F ForNow

          For CoInitialize I am getting a 0x00000001 S_FALSE (already initliazed) For CLSIDFromProgID I am getting a 0x00000000 S_OK For CoCreateInstance I am getting a 0x00000000 S_OK For GetIDsOfNames I am getting a 0X80020006 DISP_E_UNKNOWNNAME Thanks

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          I have tried this code with a variety of names (supposedly in Excel) but get the same response each time. The MSDN documentation is not very helpful so I'm not sure where to go from here. However, once again I would ask, what problem are you actually trying to solve?

          1 Reply Last reply
          0
          • F ForNow

            For CoInitialize I am getting a 0x00000001 S_FALSE (already initliazed) For CLSIDFromProgID I am getting a 0x00000000 S_OK For CoCreateInstance I am getting a 0x00000000 S_OK For GetIDsOfNames I am getting a 0X80020006 DISP_E_UNKNOWNNAME Thanks

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            I just tried again with the name "worksheets" and it worked. So, the code is correct, but the name you are using is not.

            F 1 Reply Last reply
            0
            • L Lost User

              I just tried again with the name "worksheets" and it worked. So, the code is correct, but the name you are using is not.

              F Offline
              F Offline
              ForNow
              wrote on last edited by
              #6

              Very good you are right on the key is the first paramter _In_ LPCOLESTR lpszProgID, The Class id name, Excel is divded into for objects Application, Workbook, Worksheet, and I think Range In Visual C++ 6.0 there is a OLE/COM viewer which might kind a hint of the names What I am trying to do, My boss gave me an assignment to automate the pasting of .txt file onto a Excel Worksheet I wanted this app to be MFC based as I might need to employ windows services Hence the main thread CWinApp and associated mainwindow Thanks again for your help

              L 1 Reply Last reply
              0
              • F ForNow

                Very good you are right on the key is the first paramter _In_ LPCOLESTR lpszProgID, The Class id name, Excel is divded into for objects Application, Workbook, Worksheet, and I think Range In Visual C++ 6.0 there is a OLE/COM viewer which might kind a hint of the names What I am trying to do, My boss gave me an assignment to automate the pasting of .txt file onto a Excel Worksheet I wanted this app to be MFC based as I might need to employ windows services Hence the main thread CWinApp and associated mainwindow Thanks again for your help

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                A quick search for "Excel C++" finds Accessing Excel Spreadsheets via C++[^].

                F 2 Replies Last reply
                0
                • L Lost User

                  A quick search for "Excel C++" finds Accessing Excel Spreadsheets via C++[^].

                  F Offline
                  F Offline
                  ForNow
                  wrote on last edited by
                  #8

                  Richard, I have to wait for years here to get a better compiler e.g. Visual Studio However Visual C++ 6.0 has an OLE/COM viewer So...... From File -> Run the Registry Editor Then get the progid http://msdn.microsoft.com/en-us/library/aa911706.aspx[^]

                  1 Reply Last reply
                  0
                  • L Lost User

                    A quick search for "Excel C++" finds Accessing Excel Spreadsheets via C++[^].

                    F Offline
                    F Offline
                    ForNow
                    wrote on last edited by
                    #9

                    I am going to go with the method you pointed out had using AS i GET BY THE DISP_E_UNKNOWN Maybe the way excel was installed it ddn't make entries for HKCR\Typlib for the excel methods properties Thanks

                    L 1 Reply Last reply
                    0
                    • F ForNow

                      I am going to go with the method you pointed out had using AS i GET BY THE DISP_E_UNKNOWN Maybe the way excel was installed it ddn't make entries for HKCR\Typlib for the excel methods properties Thanks

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #10

                      You can find (most of?) the names in the Excel object properties[^]; I don't know where you got "OpenText" from.

                      F 1 Reply Last reply
                      0
                      • L Lost User

                        You can find (most of?) the names in the Excel object properties[^]; I don't know where you got "OpenText" from.

                        F Offline
                        F Offline
                        ForNow
                        wrote on last edited by
                        #11

                        http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.workbooks.opentext(d=printer,v=office.11).aspx[^] When I orignally coded the app and used the #import method I didn't find which led me to use native OLE functions Then I got stuck with GetIDSofnames Now I found the api in my excel.h header must of overlooked thanks

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

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