den...@gmail.com wrote:
> I have a problem importing a Microsoft Office type libraries into my
> application. I am using Visual Studio 2005. I tried it with both
> #import directive and wizard->AddClass->FromTypeLib. Nothing seems to
> work. Lately I found this article:
> http://support.microsoft.com/kb/307473. I'm doing exactly as they
> say, however I'm not able even to compile
> the project. Because of a huge amount of errors I receive during
> compilation, I think that there some kind of basic problem I can't
> find.
I use these #imports without problems in VS2005
// Office
#import "libid:2DF8D04C-5BFA-101B-BDE5-00AA0044DE52" version("2.4")
lcid("0") named_guids raw_dispinterfaces
//Word
#import "libid:00020905-0000-0000-C000-000000000046" version("8.4")
lcid("0") auto_search no_dual_interfaces raw_dispinterfaces
rename("ExitWindows", "wordExitWindows")
// Excel
#import "libid:00020813-0000-0000-C000-000000000046" version("1.6")
lcid("0") auto_search no_dual_interfaces raw_dispinterfaces
rename("DialogBox", "excelDialogBox") rename("RGB", "excelRGB")
// PowerPoint
#import "libid:91493440-5A91-11CF-8700-00AA0060263B" version("2.9")
lcid("0") auto_search no_dual_interfaces raw_dispinterfaces
--
SvenC
1. I used your #import statement for Excel. When I compiled it, I got
dozens of errors in excel.tlh file.
2. I tried to do import by wizard: Add->Class->MFC type Library-
>Excel. When I do this, wizard creates a wraper slass for each
interface.
As soon as I do #include for an interface class header
(CAplication, for example), compiler finds over two hundred of errors
- all in excel.tlh file.
All this is done in VS2005.
Pleasse advice!
den...@gmail.com wrote:
> Hi, SvenC!
> Thank you for your answer.
> I tried using type libraries in two different ways:
>
> 1. I used your #import statement for Excel. When I compiled it, I got
> dozens of errors in excel.tlh file.
Did you #import the office type lib also?
// Office
#import "libid:2DF8D04C-5BFA-101B-BDE5-00AA0044DE52" version("2.4")
lcid("0") named_guids raw_dispinterfaces
// Excel
#import "libid:00020813-0000-0000-C000-000000000046" version("1.6")
lcid("0") auto_search no_dual_interfaces raw_dispinterfaces
rename("DialogBox", "excelDialogBox") rename("RGB", "excelRGB")
Remember that you must *not* include the tlh file. That is done
automatically.
I never tried the MFC wizard, so I am of no help there.
--
SvenC
hey try this.. worked for me.. maybe works for you as well..
add the foll 2 lines of code(2 #import lines..) at the end of ure
stdafx.h file ..
#import "libid:2DF8D04C-5BFA-101B-BDE5-00AA0044DE52"
version("2.4")lcid("0") named_guids raw_dispinterfaces
#import "libid:00020813-0000-0000-C000-000000000046"
version("1.6")lcid("0") auto_search no_dual_interfaces
raw_dispinterfaces rename("DialogBox", "excelDialogBox") rename("RGB",
"excelRGB")
Do lemme know if that worked. good luck
regards,
Akhil