| InfoToday Tools for Visual Rams |
| C++ Programmers |
Initially you may think it a problem to have to use late binding and hence to not have intellisense on objects in C++. However by reading the information explained in Ricks paper;
http://www.west-wind.com/presentations/c_com/c_com.htm
and using the C++ COM wrapper in the following link;
http://www.morearty.com/code/dispatch/
you will see the reasons why we have chosen the path we have. Using the wrapper is VERY powerful and allows very simple syntax such as the following.
lSuccess = o.Get("oCustomer").Invoke("Load","234324")
lcAccount = o.Get("oCustomer").Get("oData").Get("Account")
or
lnInvoices = o.Get("oInvoices").Invoke("Query","select * where account = '3434'")
Using Late binding and the wrapper you forgo intellisense but gain overall for the following reasons;
1. The IDispatch wrapper is not case sensitive with regard to property and method names. This can be quite important! For example I may accidentally change the case of a method from say "SetConnection" to "Setconnection". If you used the Type library method, then your app would fall over as "SetConnection" would no longer exist as far as c++ in concerened. Yes properties are always upper case but maybe not if i use the _commattrib function to give it a name.
2. There is no need for you to recompile your application each time the ITRDS is changed. This is a big bonus as the dll can change quite often.
3. You don't need to worry about renaming conflicting syntax.
For example there is a method called "New" in the ITRDS. Because this conflicts with c++ you need to manually edit the tlh file and change new to something else like _new. And this has to happen each time the ITRDS dll is changed and needs to be re imported