?
Solved

ATL with VB

Posted on 1999-12-19
4
Medium Priority
?
250 Views
Last Modified: 2013-11-25
Hi!

I finally created a DLL with ATL!... I build an object and use it from within Visual Basic.
I use the ATL app wizard from VC++ 5.0, then I add some objects, create properties and methods and everithing goes fine!
However all methods I implement return an HRESULT type. WHAT SHOULD I DO TO USE OTHER RETURN TYPES?.
For example I'd like to create a method that returns a BOOLEAN value. This means that when using in VB, when you write for example:
MyObject.BoolVal =
at this moment, VB detects that I'm handling a boolean value and displays a popup combo whith all possibilities (in this case True or False). How can I do this?
... And, how do I do the same wiht ennumerations?

Any help will be greatly appreciated... If you think your knowledge diserves more points just ask me!
0
Comment
Question by:trillo
  • 3
4 Comments
 
LVL 2

Author Comment

by:trillo
ID: 2293124
Edited text of question.
0
 
LVL 2

Accepted Solution

by:
arikka earned 200 total points
ID: 2293144
That's correct. Every method must retrun
HRESULT.
IF you want to use statement like in VB
do the next:
in ATL wizard for method parameters write : out parameters with retval keyword.

HRESULT MyMethod(
[out, retval] VARIANT_BOOL* ReturnVal
);
 
The retval attribute designates the parameter that receives the return value of the member.
The parameter must have the out attribute and must be a pointer type.

Now  you will be able to write in
VB :

   boolean a;
   a = MyObect.MyMethod()
0
 
LVL 2

Author Comment

by:trillo
ID: 2294222
Excellent!...

And do you know how do I do the same with enumerations, so that VB lists the possible values for a parameter?
0
 
LVL 2

Author Comment

by:trillo
ID: 2294264
Forget it! I already found out about enumerations...

Thanks a lot!
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

588 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question