Can a method return some value in ATL Active-X Dll

Hi ,

My Question is that I have made an ATL COM Dll.I have only one method in that Dll.Can my method return Boolean Value.

If Yes ,then HOW????????????????
goodamiAsked:
Who is Participating?
 
snoeglerCommented:
Sample:

[helpstring("blabla")] HRESULT DoSomething([in] long lInput, [out, retval] long *pResult);

VB-Call of sample method:

Dim res as long
res = obj.DoSomething(123);
0
 
pkreddyCommented:
Hi,
 Try the following things.

  1. Declare a [in,out] value with a BOOL* var. Make necessary changes to your IDL file and your header, implementation files.
  2. Now in your source code in function, you assign the required boolean value to the var declaredabove.
   
  COM automatically returns you back the BOOL value you assigned in the DLL to the cleint when the function call is made.
regards,
Pavan
0
 
snoeglerCommented:
[out, retval]
0
 
pkreddyCommented:
Snoegler is right, i made a mistake there. The parameter must be marked as [out,retval] in your IDL file
0
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.