views:

109

answers:

1

I'm trying to generate _TLB import units for Outlook 2003, 2007 and 2010 (and also other OLE servers) analogous to the ones bundled with Delphi for Outlook 2000 and 2002. However, I couldn't get the type library importer to also generate the code for capturing events from the OLE servers that is found in the bundled units. The option to "Generate component wrappers" only creates wrappers for servers that are directly instantiatable but not for objects that are only returned via methods of other objects like TInspector, TExplorer, etc.

I could of course create the event handling code myself but that would be really tedious work.

Does anyone know if the importer contained with Delphi 2010 (tlibimp.exe) can be tweaked to generate that code? I really doubt that back in the day Borland created the existing Outlook2000.pas and OutlookXP.pas units manually...

Are there maybe any other tools around that can do this?

+3  A: 

Good question! I never noticed that those components were not created (I only use Word_TLB). After playing a bit with tlibimp I found out that you need the -Yc+ flag. Probably all ignore flags are default on.

NB: this is on Delphi 7 with tlibimp.exe version 7.0.4.453

The_Fox
Thanks, but no luck with that unfortunately. I got two more classes (`TOutlookApplication` (including events!) and `TDoNotUseMeFolder` (?!)) by using the `-Ya+` option but that's about it... Still no `TInspector` or `TExplorer` in the generated file... :(
Oliver Giesen
BTW: The commandline help for `tlibimp.exe` indicates the default states for each option and according to that (also verified by my tests) `-Yc` is already on (i.e. `+`) by default.
Oliver Giesen
@Oliver Giesen: I used tlibimp.exe from Delphi 7. These are the default options when I use /?: -C- -P+ -Ic- -Ip- -Ha+ -Hr+ -Hs+ -Cw- -Ps+ -Pt- -O+ -R+ -XM- -W+ -Wc+ -Yc- -Yh -Yp- -Yr- -Ya- (default C++ options not included), so I only changed the -Yc- option to -Yc+ and it worked for me.
The_Fox
@The_Fox: What's the version number reported by your `tlibimp.exe`? Mine's 12.16580 (from Delphi 2010) and the defaults are `-Ha+ -Hs+ -Hr+ -Ps+ -Pt- -O+ -R+ -XM- -W+ -Wc+ -Ya- -Yh- -Yc+ -Yp- -Yr-` (I skipped the C++-specific ones). I've got Delphi 2007 and 2009 here as well. I'll give those a try. If those can do it then this whole issue appears to be a bug in the newer version of `tlibimp.exe`...BTW: Which version of Outlook did you generate the `_TLB.pas` for? I'm currently trying with 2010...
Oliver Giesen
My version: 7.0.4.453. I generated a Wrapper for Outlook 2007. Have you tried turning all ignore options off? So `-Yc+ -Yh+ -Yp+ -Yr+ -Ya+`, or maybe a combination of those.
The_Fox
I found a Delphi 7 CD in an old box and was able to run the `tlibimp.exe` on it without installing the whole thing and with that it works! :) Thanks a lot! Using `-Ya+` (which implies `-Yc+`) I've now got the units I was looking for. Could you maybe add the information about Delphi 7 to your answer so I could accept it?So, this is definitely an issue with the newer version of the importer. Off to QC...
Oliver Giesen