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. C / C++ / MFC
  4. Debugging Dll

Debugging Dll

Scheduled Pinned Locked Moved C / C++ / MFC
comdebuggingtutorial
14 Posts 3 Posters 1 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.
  • S sarfaraznawaz

    hi every one ... i have written com dll i want to debug the dll i dont how to do it . please reply Best Regards sarfaraz

    S Offline
    S Offline
    Sivaraman Dhamodharan
    wrote on last edited by
    #2
    1. Write a exe program that uses your COM. 2) Launch the exe. 3) Open your COM Project is Visual Studio 4) Attach the already running exe with the Project. 5) Keep the break points and start debugging it.

    Programming Article

    S 1 Reply Last reply
    0
    • S Sivaraman Dhamodharan
      1. Write a exe program that uses your COM. 2) Launch the exe. 3) Open your COM Project is Visual Studio 4) Attach the already running exe with the Project. 5) Keep the break points and start debugging it.

      Programming Article

      S Offline
      S Offline
      sarfaraznawaz
      wrote on last edited by
      #3

      see am not able to understand the 4th step. attach in the sense by changing the configuration properties in that debugging and then command and passing the path of the exe. if this the way then its control not coming to break point or i may be wrong to the exe .... Best Regards Sarfaraz

      L 1 Reply Last reply
      0
      • S sarfaraznawaz

        see am not able to understand the 4th step. attach in the sense by changing the configuration properties in that debugging and then command and passing the path of the exe. if this the way then its control not coming to break point or i may be wrong to the exe .... Best Regards Sarfaraz

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

        You can debug your code by loading the DLL directly into your application rather than using it in registered mode: see the CoLoadLibrary function[^].

        S 1 Reply Last reply
        0
        • L Lost User

          You can debug your code by loading the DLL directly into your application rather than using it in registered mode: see the CoLoadLibrary function[^].

          S Offline
          S Offline
          sarfaraznawaz
          wrote on last edited by
          #5

          hi ,thanks ... one more thing i want to ask how to register the dll . am getting the error message that DLL has loaded but entry point DllRegisterserver was not found ... but am wtritten the code for it

          AFX_MANAGE_STATE(AfxGetStaticModuleState( ));

          HRESULT hr = RegisterServer (AfxGetInstanceHandle(),   // handle to dll module
                                       CLSID\_CCmpnt,	      // component CLSID
          			     g\_szFriendlyName,	      // friendly name
          			     g\_szVerIndProgID,	      // version independent prog id
          			     g\_szVerDndProgID);		// version dependent prog id
          
          
          
          return hr;
          

          its in a function name STDAPI DllRegisterServer(void) the control not coming in this function what might be cause please reply Best Regards Sarfaraz

          L 1 Reply Last reply
          0
          • S sarfaraznawaz

            hi ,thanks ... one more thing i want to ask how to register the dll . am getting the error message that DLL has loaded but entry point DllRegisterserver was not found ... but am wtritten the code for it

            AFX_MANAGE_STATE(AfxGetStaticModuleState( ));

            HRESULT hr = RegisterServer (AfxGetInstanceHandle(),   // handle to dll module
                                         CLSID\_CCmpnt,	      // component CLSID
            			     g\_szFriendlyName,	      // friendly name
            			     g\_szVerIndProgID,	      // version independent prog id
            			     g\_szVerDndProgID);		// version dependent prog id
            
            
            
            return hr;
            

            its in a function name STDAPI DllRegisterServer(void) the control not coming in this function what might be cause please reply Best Regards Sarfaraz

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

            I don't see any declaration of DllRegisterServer()[^] in the above.

            S 1 Reply Last reply
            0
            • L Lost User

              I don't see any declaration of DllRegisterServer()[^] in the above.

              S Offline
              S Offline
              sarfaraznawaz
              wrote on last edited by
              #7

              STDAPI DllRegisterServer(void) this i used in this only i written the code

              L 1 Reply Last reply
              0
              • S sarfaraznawaz

                STDAPI DllRegisterServer(void) this i used in this only i written the code

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

                Used where? Please show the actual declaration. Also make sure that you are exporting this correctly in your build.

                S 1 Reply Last reply
                0
                • L Lost User

                  Used where? Please show the actual declaration. Also make sure that you are exporting this correctly in your build.

                  S Offline
                  S Offline
                  sarfaraznawaz
                  wrote on last edited by
                  #9

                  hi thanks again now its getting register. i was not exporting correctly .. The dll i wrote for the context menu this is done in 32 bit machine but in 64 bit machine the context menu is not coming ... what might be the problem

                  L 1 Reply Last reply
                  0
                  • S sarfaraznawaz

                    hi thanks again now its getting register. i was not exporting correctly .. The dll i wrote for the context menu this is done in 32 bit machine but in 64 bit machine the context menu is not coming ... what might be the problem

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

                    sarfaraznawaz wrote:

                    the context menu is not coming ...
                    what might be the problem

                    Any one of a million things. As I just said to someone else in these forums, you need to give specific details, don't expect people to be able to guess what is happening in your code.

                    S 1 Reply Last reply
                    0
                    • L Lost User

                      sarfaraznawaz wrote:

                      the context menu is not coming ...
                      what might be the problem

                      Any one of a million things. As I just said to someone else in these forums, you need to give specific details, don't expect people to be able to guess what is happening in your code.

                      S Offline
                      S Offline
                      sarfaraznawaz
                      wrote on last edited by
                      #11

                      ok sorry .. the code i build in 32 bit its success but when i configure the VS 2010 for 64 bit the error message con not instantiate the HRESULT IContextMenu::GetCommandString(UINT_PTR,UINT,UINT *,LPSTR,UINT)' : is abstract see declaration of 'IContextMenu::GetCommandString' why this conflict

                      L 1 Reply Last reply
                      0
                      • S sarfaraznawaz

                        ok sorry .. the code i build in 32 bit its success but when i configure the VS 2010 for 64 bit the error message con not instantiate the HRESULT IContextMenu::GetCommandString(UINT_PTR,UINT,UINT *,LPSTR,UINT)' : is abstract see declaration of 'IContextMenu::GetCommandString' why this conflict

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

                        No idea, once again there is not enough information for me to guess.

                        S 1 Reply Last reply
                        0
                        • L Lost User

                          No idea, once again there is not enough information for me to guess.

                          S Offline
                          S Offline
                          sarfaraznawaz
                          wrote on last edited by
                          #13

                          In DLL i have written the code for Context menu in vs2010 using COM i derived the class CRsEraser : public IContextMenu, public IShellExtInit this IShellExtInit and IContextMenu is are com class when use it HRESULT __stdcall CCmpntFactory::CreateInstance (IUnknown *pUnknownOuter, const IID& iid, void** ppv) { if(pUnknownOuter != NULL) return CLASS_E_NOAGGREGATION; CRsEraser *pCmpnt = new CRsEraser; if (pCmpnt == NULL) return E_OUTOFMEMORY; HRESULT hr = pCmpnt->QueryInterface (iid, ppv); ////////////////////////////////////////////////////////////////////////// // Release the IUnknown pointer pCmpnt->Release (); return hr; } CRsEraser *pCmpnt = new CRsEraser;this part showing its abstract class . in 32 bit compile its working fine same when configure to 64 bit its throwing the error what i have mention earlier . how i configure: 1 Open your Visual C++ Solution 2 Choose Build->Configuration Manager menu 3 Inside the Configuration Manager window, change the ‘Active solution platform’ to x64. If you don’t have any, you would need to create one by selecting the ‘New..’ drop down item. Copy settings from your Win32 platform. 4 Now rebuild your solution.

                          S 1 Reply Last reply
                          0
                          • S sarfaraznawaz

                            In DLL i have written the code for Context menu in vs2010 using COM i derived the class CRsEraser : public IContextMenu, public IShellExtInit this IShellExtInit and IContextMenu is are com class when use it HRESULT __stdcall CCmpntFactory::CreateInstance (IUnknown *pUnknownOuter, const IID& iid, void** ppv) { if(pUnknownOuter != NULL) return CLASS_E_NOAGGREGATION; CRsEraser *pCmpnt = new CRsEraser; if (pCmpnt == NULL) return E_OUTOFMEMORY; HRESULT hr = pCmpnt->QueryInterface (iid, ppv); ////////////////////////////////////////////////////////////////////////// // Release the IUnknown pointer pCmpnt->Release (); return hr; } CRsEraser *pCmpnt = new CRsEraser;this part showing its abstract class . in 32 bit compile its working fine same when configure to 64 bit its throwing the error what i have mention earlier . how i configure: 1 Open your Visual C++ Solution 2 Choose Build->Configuration Manager menu 3 Inside the Configuration Manager window, change the ‘Active solution platform’ to x64. If you don’t have any, you would need to create one by selecting the ‘New..’ drop down item. Copy settings from your Win32 platform. 4 Now rebuild your solution.

                            S Offline
                            S Offline
                            sarfaraznawaz
                            wrote on last edited by
                            #14

                            please help me out of this ... dll is getting register in 32 bit machine same code i compile on 64 bit machine but failing to register

                            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