Including methods in a DLL
-
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 ;)
-
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 ;)
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:
-
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 ;)
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)
-
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 ;)
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:
-
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)
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
-
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:
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