c++ - Using Excel through vtable interface -
i learning com programming via c++. understand, on client side of dual interfaces have 2 choices:
- acquire idispatch interface, query dispids getidsofnames, , use invoke access methods , properties.
- include .h header files interface definitions , .c source files guids created midl in project , call functions directly through vtable, known compiler .h files.
i create quite complex excel workbook c++ program (and insist on using c++ instead of c# or else). using 1. way able write program runs correctly. however, have 2 problems: (a) code quite clumsy because of calls invoke, (b) quite fast faster.
so try 2. way. missing .h , .c files because unlike in examples in books read, these files not created example project microsoft.
my questions are:
- where can find these files?
- how performance improvement can hope way 2. compared way 1.?
i recommend not it. and, have reasons...
for simple things, spinning excel.exe , marshaling data 1 process process eats of time. things magnitude greater might gain in using c++ interfaces.
however, big reason this: office doesn't installed or registered correctly on client machine...for whatever reason. happens interfaces not registered correctly. if interfaces not registered correctly, pulling hair out trying figure out why program failing. might figure out. recourse tell customer re-install office , hope installs correctly, or create .reg file , have customer apply reg file fix interfaces if has administrator privileges , know missing interfaces.
if use idispatch, doesn't matter if interfaces missing. i've learned hard way word. have working...
if insist, can try:
#import "progid:excel.sheet" // plus bunch of other options rename() etc...
Comments
Post a Comment