ActiveX midl error confusion

I'm on NT 4.0 and using DevStudio C++ version 5.0. I'm figuring out how to create an ActiveX control. I generate the project, go to Class Wizard and add a method. The method returns void and has three arguments. I select from the drop down list:

inStr    as   LPCSTR
outStr   as   BSTR*
outLong  as   long*

The code that Developer studio drops into my source file is as follows:

void CIQTMtrlaCtrl::IQTStringConv(LPCTSTR inStr, BSTR FAR* outStr, long FAR* outLong)
      // TODO: Add your dispatch handler code here


If I try to compile at this point I get the following:

Creating Type Library...
Error executing midl.exe.


There's no information as to why I'm getting the midl.exe error message. I've inserted no code. I'm just trying to compile generated code here. Does anyone have any clue why the compiler is dying on code that was generated by devstudio?

Who is Participating?
Hi there,
Thanks for providing ur workspace..
I just complied ur workspace and got same error.
Then I did some steps and it works fine.U can try it..
1. Delete ur methods ....from ctrl class and from declaration from interface.
I mean all functions other than about box.
2.Rebuild  ur workspace..
3.Then add methods again..
Hope it will work..
give me comment also if not work
Regards keshav
do u mean that ur just getting the message "Error executing midl.exe" without any error code.?

Usually if u dont have any midl compiler installed on ur system then u get the error message
"Error spawning midl.exe"

U can do one thing u search for the midl.exe file in ur VC install directory. if it does not exits then u will have to reinstall it.....

if it exits then may be the command line options specified in ur
Project Settings\MIDL tab are not proper.

U first clear all the options in this tab. And try again.

if this does not work then try compiling ur .idl file from command prompt.


1. Change to the directory that contains the .idl file to be compiled.

2. Type at the command prompt

"midl file.idl /h file.h /idd file_i.c /tlb file.tlb"

where file = your .idl filename

if this does not work then
try out this command

"midl file.idl /mktyplib203 /h file.h /idd file_i.c /tlb file.tlb"

Try out these options and hope it works out fine for u.......

Reply back with ur comments ASAP.


winkleAuthor Commented:
Yes.  I am getting this error message with no error code.  I did do a "find," I have midl.exe; it runs if I make no changes to the generated code.  I do not understand why I am getting this error message, and the lack of a code explaining it is the problem.  Thank you.
can u send the work space to me......
Thanks for accepting answer..
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.