|
-
November 21st, 2005, 11:10 AM
#1
import IDL file in MFC project
Hi,
I have a big MFC project, already using ocx's and exe server's where I use the #import function to include their methods.
The project is not in UNICODE this is a very simple MFC project, using some COM functionnality but only through SmartPointers or COleDispatch...
Now I need to include in this big project a new declaration of objects from an IDL file.
But just using midl to generate tlb file gives me lot of UNICODE things with wide char and so on and really no facilities to use it (looking through Internet shows that with .NET it is simpler)
Is it possible to generate from the idl file directly a tlh and tli that defines interfaces like importing an OCX with BSTR and stuff like that and the SmartPointer.
I have tried to use directly #import but of course it does not work.
It is to reduce the work of course ;-))
Please can someone help on that?
Thanks a lot
-
November 21st, 2005, 11:19 AM
#2
Re: import IDL file in MFC project
 Originally Posted by F.Mayis
Now I need to include in this big project a new declaration of objects from an IDL file.
IDL file contains only interface definitions - not objects.
IDL = Interface Definition Language
 Originally Posted by F.Mayis
But just using midl to generate tlb file gives me lot of UNICODE things with wide char and so on and really no facilities to use it
What do you mean by "things"?
And, why are the things a problem?
Is it possible to generate from the idl file directly a tlh and tli that defines interfaces like importing an OCX with BSTR and stuff like that and the SmartPointer.
You need to get these from a Type Library, and not from an IDL.
Code:
Compile IDL --> Get TLB
#import "TLB" --> Use Interfaces
And...
 Originally Posted by F.Mayis
I have tried to use directly #import but of course it does not work.
Where did you do this? Post code.
-
November 21st, 2005, 11:51 AM
#3
Re: import IDL file in MFC project
Hi,
Thanks for the quick answer
And in fact I think I have it.
I have generated from the idl files the TLB.
Then just done an import of these TLB files and it seems to work.
Exactly as you say in your post.
Thanks again
-
November 21st, 2005, 11:53 AM
#4
Re: import IDL file in MFC project
Great... Using the TLB is the correct way to access a COM Server...
-
November 21st, 2005, 11:58 AM
#5
Re: import IDL file in MFC project
On a related note, it is possible to import an external IDL in a project's IDL, like this -
Code:
import "ServersIDL.idl";
...In the Project's IDL File.
However, this creates a strong bind between the Server and Client, and must be avoided to the extent possible.
-
November 21st, 2005, 11:59 AM
#6
Re: import IDL file in MFC project
thanks for the precision
-
November 21st, 2005, 12:00 PM
#7
Re: import IDL file in MFC project
You are welcome...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|