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. Register dll com component

Register dll com component

Scheduled Pinned Locked Moved COM
csharpcomlinuxjsontutorial
5 Posts 3 Posters 0 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.
  • A Offline
    A Offline
    ass3aad
    wrote on last edited by
    #1

    I wnat to know how to register a dll com component in C# using windows APi not a shell command. Please I need it urgently.

    R G 2 Replies Last reply
    0
    • A ass3aad

      I wnat to know how to register a dll com component in C# using windows APi not a shell command. Please I need it urgently.

      R Offline
      R Offline
      Roger Stoltz
      wrote on last edited by
      #2

      1. Load the dll with ::LoadLibrary() 2. Get the address of the library's exported function DllRegisterServer with ::GetProcAddress() 3. Call the library's DllRegisterServer() 4. Unload the library with ::FreeLibrary() Like this, pasted from MSDN:

      typedef HRESULT (STDAPICALLTYPE *CTLREGPROC)() ; // Requires stdole.h
      HMODULE hModule = ::LoadLibrary(m_strPathName) ;
      CTLREGPROC DLLRegisterServer =
      (CTLREGPROC)::GetProcAddress(hModule,"DllRegisterServer" ) ;
      DLLRegisterServer() ;
      ::FreeLibrary(hModule) ;

      Hope this helps -- Roger


      _It's supposed to be hard, otherwise anybody could do it!

      Regarding CodeProject: "resistance is pointless; you will be assimilated"_

      A 1 Reply Last reply
      0
      • R Roger Stoltz

        1. Load the dll with ::LoadLibrary() 2. Get the address of the library's exported function DllRegisterServer with ::GetProcAddress() 3. Call the library's DllRegisterServer() 4. Unload the library with ::FreeLibrary() Like this, pasted from MSDN:

        typedef HRESULT (STDAPICALLTYPE *CTLREGPROC)() ; // Requires stdole.h
        HMODULE hModule = ::LoadLibrary(m_strPathName) ;
        CTLREGPROC DLLRegisterServer =
        (CTLREGPROC)::GetProcAddress(hModule,"DllRegisterServer" ) ;
        DLLRegisterServer() ;
        ::FreeLibrary(hModule) ;

        Hope this helps -- Roger


        _It's supposed to be hard, otherwise anybody could do it!

        Regarding CodeProject: "resistance is pointless; you will be assimilated"_

        A Offline
        A Offline
        ass3aad
        wrote on last edited by
        #3

        Thank you for your help. But please could you give me the C# code becuase I am not good in C++.

        R 1 Reply Last reply
        0
        • A ass3aad

          Thank you for your help. But please could you give me the C# code becuase I am not good in C++.

          R Offline
          R Offline
          Roger Stoltz
          wrote on last edited by
          #4

          ass3aad wrote:

          But please could you give me the C# code becuase I am not good in C++.

          Sorry, I don't do C#, but you should be able to figure it out. I don't think the two languages should differ that much. The flow is the same as in any language and the API calls made are the same. -- Roger


          _It's supposed to be hard, otherwise anybody could do it!

          Regarding CodeProject: "resistance is pointless; you will be assimilated"_

          1 Reply Last reply
          0
          • A ass3aad

            I wnat to know how to register a dll com component in C# using windows APi not a shell command. Please I need it urgently.

            G Offline
            G Offline
            Ganesh_T
            wrote on last edited by
            #5

            use: String s = regsvr32 + "File name"; System.Diagnostics.Process.Start(s); Cheers "Peace of mind through Technology"

            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