[COM] How to use the .idl ?

  • Thread starter Thread starter Vincent Lascaux
  • Start date Start date
V

Vincent Lascaux

Hi,

I need to implement the IDownloadManager interface. I found the files
DownloadMgr.h and DownloadMgr.idl that define this interface, but I dont
know what to do know ;-)
I saw somewhere that I need to use the midl tool... so,

C:\Temp\Include>midl downloadmgr.idl
'midl' n'est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.

(I try a translation : 'midl' is not reconized as an internal or external
command, an executable program or a command file)
It might be a problem with the path variable. But even when I add the midl
path by myself (I dont know why I should do that indeed), it doesnt work :

C:\Temp\Include>midl downloadmgr.idl
Microsoft (R) 32b/64b MIDL Compiler Version 6.00.0361
Copyright (c) Microsoft Corporation 1991-2002. All rights reserved.
Processing .\downloadmgr.idl
midl : command line error MIDL1005 : cannot find C preprocessor cl.exe


What must I do to get the compiled version of DownloadMgr.idl ? (or where
can I find it on the web ?)

Thanks
 
Vincent, a couple of things from your post. First of all, did you install
C++ with VS.Net? If you did, do you have a VS.Net Command Prompt link in
Start|Programs|Microsoft Visual Studio...|Visual Studio .Net Tools|? If you
do use that and then run midl. That command prompt has all of the paths set
up for you already.

Second, Looks like you've been working on this for a while from all of the
newsgroup posts you've put out there. I take it you have read the
"Implementing a Custom Download Manager" on MSDN?

Let us know how the midl/tlb creation goes once you use the .Net command
prompt.
 
Vincent, a couple of things from your post. First of all, did you install
C++ with VS.Net? If you did, do you have a VS.Net Command Prompt link in
Start|Programs|Microsoft Visual Studio...|Visual Studio .Net Tools|? If you
do use that and then run midl. That command prompt has all of the paths set
up for you already.

Great, it nearly works now... I got the same problem as
http://minilien.com/?pSUp7xEQ3s : no tlb file is created...
To files (downloadmgr_i.c and downloadmgr_p.c) were generated by midl...
Second, Looks like you've been working on this for a while from all of the
newsgroup posts you've put out there. I take it you have read the
"Implementing a Custom Download Manager" on MSDN?

Yes, I read it... It looks pretty simple in fact (once you've setted it up).
I still wonder what will be the C# equivalents of the HRESULT, IMoniker...
types used as function parameters...

Thanks
 
Vincent,

You will not have to worry about the HRESULT, as that will be used by
the runtime to throw exception information should an error occur. For the
IMoniker type, it is already defined in the framework. Look in the
System.Runtime.InteropServices namespace, and the UCOMIMoniker interface
will give you what you need.

Hope this helps.
 
Vincent, what are you putting at the command line? I can use

midl downloadmgr.idl /tlb downloadmgr.tlb

and it works great. Are you missing the tlb switch? Try midl /? for more
info on command line options.
 
Greg Ewing said:
Vincent, what are you putting at the command line? I can use

midl downloadmgr.idl /tlb downloadmgr.tlb

and it works great. Are you missing the tlb switch? Try midl /? for more
info on command line options.

Here is what I did. I had no tlb file generated...

C:\Temp\Include>midl downloadmgr.idl /h downloadmgr.h /tlb downloadmgr.tlb
Microsoft (R) 32b/64b MIDL Compiler Version 6.00.0361
Copyright (c) Microsoft Corporation 1991-2002. All rights reserved.
Processing .\downloadmgr.idl
downloadmgr.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\PlatformSDK\include\unknwn.idl
unknwn.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\PlatformSDK\include\wtypes.idl
wtypes.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\PlatformSDK\include\basetsd.h
basetsd.h
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\PlatformSDK\include\guiddef.h
guiddef.h
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\PlatformSDK\include\ocidl.idl
ocidl.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\PlatformSDK\include\oleidl.idl
oleidl.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\PlatformSDK\include\objidl.idl
objidl.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\PlatformSDK\include\oaidl.idl
oaidl.idl
Processing .\servprov.idl
servprov.idl
Processing .\urlmon.idl
urlmon.idl
Processing .\msxml.idl
msxml.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\PlatformSDK\include\oaidl.acf
oaidl.acf
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\PlatformSDK\include\ocidl.acf
ocidl.acf
64 bit Processing .\downloadmgr.idl
downloadmgr.idl
64 bit Processing C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\PlatformSDK\include\unknwn.idl
unknwn.idl
64 bit Processing C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\PlatformSDK\include\wtypes.idl
wtypes.idl
64 bit Processing C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\PlatformSDK\include\basetsd.h
basetsd.h
64 bit Processing C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\PlatformSDK\include\guiddef.h
guiddef.h
64 bit Processing C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\PlatformSDK\include\ocidl.idl
ocidl.idl
64 bit Processing C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\PlatformSDK\include\oleidl.idl
oleidl.idl
64 bit Processing C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\PlatformSDK\include\objidl.idl
objidl.idl
64 bit Processing C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\PlatformSDK\include\oaidl.idl
oaidl.idl
64 bit Processing .\servprov.idl
servprov.idl
64 bit Processing .\urlmon.idl
urlmon.idl
64 bit Processing .\msxml.idl
msxml.idl
64 bit Processing C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\PlatformSDK\include\oaidl.acf
oaidl.acf
64 bit Processing C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\PlatformSDK\include\ocidl.acf
ocidl.acf

C:\Temp\Include>dir download*
Le volume dans le lecteur C n'a pas de nom.
Le numéro de série du volume est BC0C-7D55

Répertoire de C:\Temp\Include

08/10/2003 18:30 6 191 downloadmgr.h
02/11/2001 12:19 2 763 downloadmgr.idl
08/10/2003 18:30 3 648 downloadmgr_i.c
08/10/2003 18:30 9 031 downloadmgr_p.c
4 fichier(s) 21 633 octets
 
Back
Top