ATL 7.0 Passing SafeArrays
-
I want to pass a SafeArray to a VB Client but I can't seem to get the right syntax for the IDL. Can someone please help me. Forever Developing
-
I want to pass a SafeArray to a VB Client but I can't seem to get the right syntax for the IDL. Can someone please help me. Forever Developing
-
I should have been more clear. I want to pass the SafeArray pointer out to VB 6 in ATL 3.0. I used to be able to do this with the following code. foo(SAFEARRAY(long) *psa); However the same thing in ATL 7.0 won't compile NOTE: I am using an emedded idl VS.NET //Actual code #define _ATL_ATTRIBUTES 1 #include "stdafx.h" #include "resource.h" #include "atlbase.h" #include "atlcom.h" #include "oleauto.h" #include "atlsafe.h" #include "oaidl.h" // The module attribute causes DllMain, DllRegisterServer and DllUnregisterServer to be automatically implemented for you [ module(dll,name="ATL7TEST")]; [object, dual, uuid(4D9BCA91-2F02-4cee-A589-2CC4D9821156)] __interface IATL7TEST { HRESULT TestRaiseEvent(); }; [object,uuid("8D0F6D5E-DDC3-4371-BB08-49864F5DE356")] __interface _IATL7EVENTS { HRESULT MyFirstEvent(SAFEARRAY(long*) *varname ); }; [coclass, uuid(EBAA6CB2-ED31-4e08-8DF8-068B2978C3F7),event_source(com)] class TESTING : public IATL7TEST { public: __event __interface _IATL7EVENTS; HRESULT TestRaiseEvent() { CComSafeArray Test; SAFEARRAY *psa; SAFEARRAYBOUND rgsabound[1]; rgsabound[0].lLbound = 0; rgsabound[0].cElements = 10; psa = SafeArrayCreate(VT_INT, 1, rgsabound); long test; test = 1234; LPSAFEARRAY lpsa; lpsa = psa; __raise MyFirstEvent(psa); return S_OK; } }; //compilation errors //v:\ATL7TEST\ATL7TEST.cpp(33): error C2061: syntax error : identifier 'tagSAFEARRAY' //v:\ATL7TEST\ATL7TEST.cpp(33): error C2059: syntax error : ')' //v:\ATL7TEST\ATL7TEST.cpp(33): error C2143: syntax error : missing ')' before ';' Forever Developing