in a VARIANT via VT_UI1 vartype.
"Melanie Zubel" <XXXX_a_XXXXX@discussions.microsoft.com> wrote in message
news:e3j93zzZHHA.1220@TK2MSFTNGP03.phx.gbl...
Hello,
thanks for answer
I suggest you lose the attributes in your ATL project.
Then there's an ATL Wizard to create a proxy class
for firing your events. You can also check a box when
you create your ATL class so the event mechanism
is created for you from the start.
Have you a simple project, example, maybe with screenshots.
- C# Visual Studio 2005
- ATL interface (without function, only interface!) No function.
- MFC Server Visual Studio 2005, MFC
Melanie, I'll try to give you some general tips, without the screenshots.
Basically, what you are after is an ATL object that acts like a shim for
your MFC application. As Alexander suggestion, create a simple ATL project
taking care not to check the "Attributed" checkbox. Also, check the
"Support MFC" checkbox. Right-click over the project name and "Add
Class...", specifically an ATL Simple object. Options typically should
include ISupportErrorInfo for rich error information, and of course you
will need to check "Connection Points" since you want to support events.
Create the method names and parameters by right-clicking over the
interface name seen in the Class View. Your event method can also be
defined by expanding the type library and right-clicking over the event
interface. It will looks something like _I<myobject>Events.
The wizard will generate the functions that support the interface methods.
You seem to believe that this should somehow be suppressed. Instead,
populate the body of the function with code that calls the appropriate MFC
function. That's your shim code.
Simple interface, like this
BOOL ValidatePhoneNumber(BSTR Number, BYTE* pError, BSTR* pErrorString);
event Finish();
string m_sInhalt;
C# will naturally marshal BSTRINGS to the C# 'string' type if you use a
COM Interop. I suggest changing pError to some other type that is
ole-automation compatible. If it is a string, use a BSTR* type instead.
(I'm assuming this is output).
HTH
Brian