Windows ole word automatism / use JUNO
JohnC
johnch_atms at hotmail.com
Wed Nov 15 04:16:40 PST 2006
"Gregor Kopp" <gk at cutcopy.com> wrote in message
news:ejepvc$1h3m$1 at digitaldaemon.com...
> Hm. I played around with it now for several hours. With Tlbimpd I always
> get an access violation, i dont know why. But I must say, that I don't
> know if I did it the right way. I seems that ive always the poor stupid
> guy who does always wants to learn something about new technologies and
> always gets undocumented pieces of software :(
> Its really annoying.
Sorry it's not documented. I'm readying a new release of my Juno library and
related tools, and will provide documentation this time around. It should be
done by late December.
For now, get the latest test version of tlbimpd from
http://wwwpaperocean.org/d/tlbimpd.zip. The /? switch on the command line
explains the various options.
Tlbimpd attempts to generate a D source module from a COM type library. It
doesn't work on every type library yet. And when it does work you might need
to tweak the generated files to get them to compile.
I just ran this version of tlbimpd on msword.olb, and it generated word.d
without any errors. Here's what you need to do to get Word automation
working:
1) Run tlbimpd (the latest version from the above link) on msword.olb,
mso.dll and vbe6ext.olb.
I had to search my system for vbe6ext.olb. It was buried in a CAB file - if
that's the same for you, copy it to another location before using tlbimpd on
it.
2) Download http://www.paperocean.org/d/comtest.zip and use the com module
from there instead of the one from Juno.
3) Import the resulting "office" and "vbide" modules into word.d, like this:
private import com, office, vbide;
Import the "office" module into vbide.d.
4) office.d requires IPictureDisp, which isn't defined in the included com
module (I'll add it in the next release) so add the following lines to the
bottom of the "com" module:
interface IPictureDisp : IDispatch {
static GUID IID = { 0x7BF80981, 0xBF32, 0x101A, 0x8B, 0xBB, 0x00,
0xAA, 0x00, 0x30, 0x0C, 0xAB };
}
5) Try to compile everything, using DMD. You'll get a few errors saying
something like "Range is used as a type". This means that Range is defined
as a type but is also the name of a function, and they clash. So just go
through them in turn and prefix the function names where the errors occur
with "get_". For example change the function named Range to get_Range.
After following these steps, it should all compile.
I know I said it was easier to use early binding rather than late binding,
and while this may make you think otherwise, it'll save you a lot of work in
the long run.
>
> I thought about using OleView and do it by hand about 2 seconds ;)
> Im a Noob about such things, I think I need 3-4 years of experience before
> I know what I'm doing with that *g*
>
> Anyway, enough mimimimi...
>
> Can anyone tell me what I could do to reach my goal? I would be really be
> sad if i have to drop my interest on D because the lack of my knowledge
> about windows programming.
>
> But maybe Im just to dump to use Tlbimpd :/
> I don't know...
If you follow the guidance above, you shouldn't need to drop either.
More information about the Digitalmars-d
mailing list