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. Including methods in a DLL

Including methods in a DLL

Scheduled Pinned Locked Moved C / C++ / MFC
csstutorialquestion
6 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.
  • S Offline
    S Offline
    softwaremonkey
    wrote on last edited by
    #1

    Hi, I have written a DLL to encapsulate the Winword interface which works OK but I would like to include all of (or maybe a sub-set of) the methods defined in msword9.h in my DLL without me having to write a wrapper for every method. This is because I have wrapper functions for the most commonly used things but sometimes I need to do some other less-used thing and I end up having to re-build the DLL. For example I have a GetActiveDoc() method an I would like to be able to use this pointer to call any of the _Document methods. Is there a way to force the complier to include all functions and methods declared in msword9.h in my DLL build? Thanks Tony ;)

    Y M 3 Replies Last reply
    0
    • S softwaremonkey

      Hi, I have written a DLL to encapsulate the Winword interface which works OK but I would like to include all of (or maybe a sub-set of) the methods defined in msword9.h in my DLL without me having to write a wrapper for every method. This is because I have wrapper functions for the most commonly used things but sometimes I need to do some other less-used thing and I end up having to re-build the DLL. For example I have a GetActiveDoc() method an I would like to be able to use this pointer to call any of the _Document methods. Is there a way to force the complier to include all functions and methods declared in msword9.h in my DLL build? Thanks Tony ;)

      Y Offline
      Y Offline
      Yajnesh Narayan Behera
      wrote on last edited by
      #2

      I do not know whether there is any method provided by complier itself. In my project what I have done is added the whole power point class after importing them from the TLB file. You can get how to import all the methods from a TLB from CodeProject. :laugh:

      1 Reply Last reply
      0
      • S softwaremonkey

        Hi, I have written a DLL to encapsulate the Winword interface which works OK but I would like to include all of (or maybe a sub-set of) the methods defined in msword9.h in my DLL without me having to write a wrapper for every method. This is because I have wrapper functions for the most commonly used things but sometimes I need to do some other less-used thing and I end up having to re-build the DLL. For example I have a GetActiveDoc() method an I would like to be able to use this pointer to call any of the _Document methods. Is there a way to force the complier to include all functions and methods declared in msword9.h in my DLL build? Thanks Tony ;)

        M Offline
        M Offline
        Matthew Faithfull
        wrote on last edited by
        #3

        I think the simple answer to your question is no. However COM does allow you to do this sort of thing. I'm sure MSWord still exposes COM interfaces and it might be possible to aggregate them with your own wrapper object. In that case anything exposed by Word would be exposed your object. If this sounds like it might help then you'll need to look into COM aggregation.

        "The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)

        S 1 Reply Last reply
        0
        • S softwaremonkey

          Hi, I have written a DLL to encapsulate the Winword interface which works OK but I would like to include all of (or maybe a sub-set of) the methods defined in msword9.h in my DLL without me having to write a wrapper for every method. This is because I have wrapper functions for the most commonly used things but sometimes I need to do some other less-used thing and I end up having to re-build the DLL. For example I have a GetActiveDoc() method an I would like to be able to use this pointer to call any of the _Document methods. Is there a way to force the complier to include all functions and methods declared in msword9.h in my DLL build? Thanks Tony ;)

          Y Offline
          Y Offline
          Yajnesh Narayan Behera
          wrote on last edited by
          #4

          What you are trying to achieve is can easily be done in this way. My project is running fine. Basically in your interface class you have to derive the classes in this manner. class MyPPTApplication : public TOleHelper { // Operations public: LPDISPATCH GetPresentations(); } This is just a hint how in my project I have achieved this for PPT. In this way you have to get all the methods for Word, call the method in proper order & you will get the required result. GetPresentations does nothing it internally call this method LPDISPATCH result = 0; InvokeHelper(0x7d1, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); I do not know what is the use of you Dll, if it is to show the Word application then you have to create your own container object that is a whole big area in it's respect. :wtf:

          S 1 Reply Last reply
          0
          • M Matthew Faithfull

            I think the simple answer to your question is no. However COM does allow you to do this sort of thing. I'm sure MSWord still exposes COM interfaces and it might be possible to aggregate them with your own wrapper object. In that case anything exposed by Word would be exposed your object. If this sounds like it might help then you'll need to look into COM aggregation.

            "The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)

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

            Hi, Thanks for the reply. Using COM sounds like a workable solution but I have not been able to find any documentation on this - not even in the Office development kit :( Any ideas where I might find this information? :confused: Thanks Tony

            1 Reply Last reply
            0
            • Y Yajnesh Narayan Behera

              What you are trying to achieve is can easily be done in this way. My project is running fine. Basically in your interface class you have to derive the classes in this manner. class MyPPTApplication : public TOleHelper { // Operations public: LPDISPATCH GetPresentations(); } This is just a hint how in my project I have achieved this for PPT. In this way you have to get all the methods for Word, call the method in proper order & you will get the required result. GetPresentations does nothing it internally call this method LPDISPATCH result = 0; InvokeHelper(0x7d1, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); I do not know what is the use of you Dll, if it is to show the Word application then you have to create your own container object that is a whole big area in it's respect. :wtf:

              S Offline
              S Offline
              softwaremonkey
              wrote on last edited by
              #6

              Hi, Thanks for the reply. The purpose of my DLL is to wrap the code that you have suggested so that I dont have to do this in my applications. Besides which, the msword9.h documentation is so sparse, I find it can take quite a while to figure out what objects i need, what methods to call and what the parameters mean. For example, to insert a table into a document, you need need to get all kinds of objects (app, document, selection, range, table) and I dont want to have to do this each time I want to insert a table so I have a InserTable(rows, columns) method. I guess I could still do what you proposed when I want to do the lesser used objects/methods, I could call them with InvokeHelper. Thanks Tony

              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