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. ATL / WTL / STL
  4. using ATL DLL in non-ATL way

using ATL DLL in non-ATL way

Scheduled Pinned Locked Moved ATL / WTL / STL
helpquestionc++tutorial
6 Posts 4 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.
  • M Offline
    M Offline
    MonkuMonku
    wrote on last edited by
    #1

    Sorry that the subject is vague because it's hard to describe my question in one line. I have zero experience with ATL. I was given this ATL DLL project at work that embeds web browser on our application. I was using #import [browser.dll] to access the methods, and CreateInstance() to create the browser. That's how it was used in the example exe project that used that DLL. My lead suggested that I should remove #import due to its hard-coded path dependency, and I should just link it using the lib file that DLL generates during compilation. The DLL is guaranteed to reside in the same directory as the main exe, and it'll not be replaced by any other DLL. What's the best way to fix this problem? But I noticed that lib files don't generated when you compile ATL DLLs (I could be wrong). Can somebody lead me to an example? Thanks in advance.

    M M 2 Replies Last reply
    0
    • M MonkuMonku

      Sorry that the subject is vague because it's hard to describe my question in one line. I have zero experience with ATL. I was given this ATL DLL project at work that embeds web browser on our application. I was using #import [browser.dll] to access the methods, and CreateInstance() to create the browser. That's how it was used in the example exe project that used that DLL. My lead suggested that I should remove #import due to its hard-coded path dependency, and I should just link it using the lib file that DLL generates during compilation. The DLL is guaranteed to reside in the same directory as the main exe, and it'll not be replaced by any other DLL. What's the best way to fix this problem? But I noticed that lib files don't generated when you compile ATL DLLs (I could be wrong). Can somebody lead me to an example? Thanks in advance.

      M Offline
      M Offline
      MonkuMonku
      wrote on last edited by
      #2

      I should add that I could modify this ATL DLL source anyway I want. It just has to work.

      1 Reply Last reply
      0
      • M MonkuMonku

        Sorry that the subject is vague because it's hard to describe my question in one line. I have zero experience with ATL. I was given this ATL DLL project at work that embeds web browser on our application. I was using #import [browser.dll] to access the methods, and CreateInstance() to create the browser. That's how it was used in the example exe project that used that DLL. My lead suggested that I should remove #import due to its hard-coded path dependency, and I should just link it using the lib file that DLL generates during compilation. The DLL is guaranteed to reside in the same directory as the main exe, and it'll not be replaced by any other DLL. What's the best way to fix this problem? But I noticed that lib files don't generated when you compile ATL DLLs (I could be wrong). Can somebody lead me to an example? Thanks in advance.

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #3

        MonkuMonku wrote:

        My lead suggested that I should remove #import due to its hard-coded path dependency, and I should just link it using the lib file that DLL generates during compilation.

        #import has nothing to do with linking. #import generates wrapper classes for COM objects at compile time. COM operates completely at runtime and does not use LIBs to find DLLs.

        --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Dunder-Mifflin, this is Pam.

        L 1 Reply Last reply
        0
        • M Michael Dunn

          MonkuMonku wrote:

          My lead suggested that I should remove #import due to its hard-coded path dependency, and I should just link it using the lib file that DLL generates during compilation.

          #import has nothing to do with linking. #import generates wrapper classes for COM objects at compile time. COM operates completely at runtime and does not use LIBs to find DLLs.

          --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Dunder-Mifflin, this is Pam.

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #4

          Michael Dunn wrote:

          #import has nothing to do with linking.

          Yeah but his "lead" says so... idiom[^]

          S 1 Reply Last reply
          0
          • L led mike

            Michael Dunn wrote:

            #import has nothing to do with linking.

            Yeah but his "lead" says so... idiom[^]

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

            As suggested by Michael, the #import generate the wrapper classs for coclasses that are part of ATL dll, any COM DLL need to be registered before it use, and location of dll is irrelevent as it shourld be registed in the windows registry by using "regsvr32" command. if you don't want to use the #import you can directly create the instance of class by using CoCreateInstance but life is more tough without #import as you have to handle the AddRef and Release part of your own. Regards, Sunil Tonger

            L 1 Reply Last reply
            0
            • S sunil2004

              As suggested by Michael, the #import generate the wrapper classs for coclasses that are part of ATL dll, any COM DLL need to be registered before it use, and location of dll is irrelevent as it shourld be registed in the windows registry by using "regsvr32" command. if you don't want to use the #import you can directly create the instance of class by using CoCreateInstance but life is more tough without #import as you have to handle the AddRef and Release part of your own. Regards, Sunil Tonger

              L Offline
              L Offline
              led mike
              wrote on last edited by
              #6

              and you are telling me all of that because?? :confused:

              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