问题
Trying to create simple COM library using ATL in Visual Studio 2012. I do:
New ATL Project
Welcome to the ATL Project Wizard
Next
Application Settings - no change (DLL)
Next
Finish
Got a lot of files:
Trying to understand where to add simple function that can be called by COM user. I found only one place where I can add function using wizard:
But I see that something is missing there regarding parameters selection like in,out,retval.
And I was hoping that after adding new function at least IDL file will be updated too, but this not happened.
What is the way of creating simple COM class using ATL from Visual C++ from VS2012 ?
回答1:
Add a new class
Fill in fields
After this step SomeObject.h, SomeObject.cpp files will be created and added to your solution, the ISomeObject interface declaration will be added to the .idl file.
Go to Class View (the combination ctrl+shift+C by default), select
ISomeObject, add a new methodFill in fields
After this step the someMethod will be added to .idl file, .h file and .cpp file. All you have to do - is to write an implementation of someMethod in .cpp file.
来源:https://stackoverflow.com/questions/33211156/creating-com-using-atl-in-c-from-vs2012