Click here to Skip to main content
15,891,976 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: DEP (Data Execution Prevention) in WinXP SP2 and ATL/WTL thunk. Pin
Jörgen Sigvardsson23-May-07 3:56
Jörgen Sigvardsson23-May-07 3:56 
Questionusing mscomm32.ocx in ATL Exe? Pin
viral_umang@hotmail.com18-May-07 0:33
viral_umang@hotmail.com18-May-07 0:33 
QuestionExecuting Javascript in ASPX Pin
darora317-May-07 18:15
darora317-May-07 18:15 
Questionattributed ATL, forward declare interface? Pin
Jared Allen16-May-07 12:29
Jared Allen16-May-07 12:29 
AnswerRe: attributed ATL, forward declare interface? Pin
Michael Dunn18-May-07 14:57
sitebuilderMichael Dunn18-May-07 14:57 
AnswerRe: attributed ATL, forward declare interface? Pin
Jörgen Sigvardsson19-May-07 2:05
Jörgen Sigvardsson19-May-07 2:05 
AnswerRe: attributed ATL, forward declare interface? Pin
Jared Allen19-May-07 8:40
Jared Allen19-May-07 8:40 
Questionhow to convert an interface instance to SAFEARRAY Pin
bioan15-May-07 21:14
professionalbioan15-May-07 21:14 
The idea is to create some add-on in a program using COM functions interface exist in his own API.

The particular type which I try to implement is a generic one , let say MyClass, and is declared like below:
//MyClassPtr declaration;
_COM_SMARTPTR_TYPEDEF(MyClass, __uuidof(IDispatch));

//The class itself
struct __declspec(uuid("5e772660-389b-11ce-ba48-080036250302"))
MyClass : IDispatch
{
...
// other functions...
...
IDispatchPtr Function1;
__declspec(property(get=GetArea,put=PutArea))
IDispatchPtr Function2;
__declspec(property(get=GetSize))
...
}

I create an instance of MyClass using:
MyClassPtr pMyInstance;

This pMyInsatance have to be provided to another API function but in form of a SAFEARRAY!This function can look like below:

FinalFunction(SAFEARRAY * * pMyClassInstances, .. , ..)

So I have to convert my variable MyClass (can be more than one in my code of course, but I want to limit only to one instance for now) to this SAFEARRAY .. How can I do this?

I try:
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = 1;
long a=0;

SAFEARRAY * vMyClassArray;
vMyClassArray.vt = VT_VARIANT|VT_ARRAY;
vMyClassArray= SafeArrayCreate(VT_VARIANT, 1, rgsabound);
SafeArrayPutElement(vMyClassArray .parray, &a, &(pMyInstance));

Finally I put my class instance as an argument for:
FinalFunction(pMyInstance, .. , ..)

It doesn't seem to work, probably because argument pMyInstance can not be express as a VARIANT declarated type.
The class I want to work with - MyClass- which exist in a .tlh file, is part of the API interface, so it is not exactly a user define type, but more an interface define type. I mention this becose I try to work with VT_RECORD type in SafeArrayCreate(...) instead of VT_VARIANT type, but this imply an idl function declaration for my type, and other additional stuff

Any ideea ??

QuestionHow to pass an array to a COM method that accept a VARIANT * Pin
songll10-May-07 8:28
songll10-May-07 8:28 
AnswerRe: How to pass an array to a COM method that accept a VARIANT * Pin
Stuart Dootson10-May-07 21:04
professionalStuart Dootson10-May-07 21:04 
GeneralRe: How to pass an array to a COM method that accept a VARIANT * Pin
Jörgen Sigvardsson13-May-07 7:43
Jörgen Sigvardsson13-May-07 7:43 
GeneralRe: How to pass an array to a COM method that accept a VARIANT * Pin
Stuart Dootson13-May-07 8:31
professionalStuart Dootson13-May-07 8:31 
GeneralRe: How to pass an array to a COM method that accept a VARIANT * Pin
Jörgen Sigvardsson13-May-07 8:36
Jörgen Sigvardsson13-May-07 8:36 
QuestionFiring Event from worker thread - Q280512 Pin
Satishkumar.B10-May-07 4:19
Satishkumar.B10-May-07 4:19 
AnswerRe: Firing Event from worker thread - Q280512 Pin
Roger Stoltz10-May-07 21:11
Roger Stoltz10-May-07 21:11 
AnswerRe: Firing Event from worker thread - Q280512 Pin
Lim Bio Liong13-May-07 7:03
Lim Bio Liong13-May-07 7:03 
QuestionPair and iterator Pin
csx0088-May-07 20:16
csx0088-May-07 20:16 
AnswerRe: Pair and iterator Pin
Michael Sadlon24-May-07 14:31
Michael Sadlon24-May-07 14:31 
Questionhow to format a string without using MFC and CRT? Pin
samfromcn8-May-07 17:32
samfromcn8-May-07 17:32 
AnswerRe: how to format a string without using MFC and CRT? Pin
Stephen Hewitt8-May-07 17:53
Stephen Hewitt8-May-07 17:53 
QuestionHow to port C++ dll in Linux to Windows? Pin
dipuks8-May-07 16:22
dipuks8-May-07 16:22 
QuestionRe: How to port C++ dll in Linux to Windows? Pin
Hamid_RT20-May-07 19:43
Hamid_RT20-May-07 19:43 
QuestionProblem with AtlAxCreateDialog Pin
aamir.zia7-May-07 9:22
aamir.zia7-May-07 9:22 
AnswerRe: Problem with AtlAxCreateDialog Pin
Stephen Hewitt7-May-07 14:07
Stephen Hewitt7-May-07 14:07 
QuestionMenu using ATL Pin
nas_mit3-May-07 7:57
nas_mit3-May-07 7:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.