Calling ActiveX control from VB 
Author Message
 Calling ActiveX control from VB

Hi,

I have developed a simple ActiveX control that has a method that
requires a UDT to be cast as a long pointer.

Internally the control casts the pointer back to the UDT.

This control works great calling it from an MFC test program but I
cannot seem to find a way to "cast" my UDT to a long in VB.

What is the recommended way to do this?

Should I just change the control method to take seperate parameters
that are specified internally in the UDT structure?

This seems like a limitation of VB that I'm not happy about.

I mean us C/C++ Windows programmers have been casting UDTs longs
and posting/sending in messages as LPARAMs for years.

Any thoughts greatly appreciated.

Thanks.

Colin Johnson.



Tue, 01 Aug 2000 03:00:00 GMT  
 Calling ActiveX control from VB

--
Ron Ruble
Raffles Software Development, Inc.

Quote:

>Hi,

>I have developed a simple ActiveX control that has a method that
>requires a UDT to be cast as a long pointer.

>Internally the control casts the pointer back to the UDT.

>This control works great calling it from an MFC test program but I
>cannot seem to find a way to "cast" my UDT to a long in VB.

>What is the recommended way to do this?

There isn't. VB has undocumented pointer functions,
but using them is not recommended.

Quote:
>Should I just change the control method to take seperate parameters
>that are specified internally in the UDT structure?

Why not pass in the UDT ByRef from VB and allow the control
to populate it? Or a secondary class object, similar to the Node
Objects supplied by the TreeView control.

Quote:
>This seems like a limitation of VB that I'm not happy about.

Welcome to the wonderful world of no pointers; get used to it.

Quote:
>I mean us C/C++ Windows programmers have been casting UDTs longs
>and posting/sending in messages as LPARAMs for years.

And COBOL programmers do printer output by defining
PICTURES. So what? Java doesn't use pointers directly either.
VB isn't intended to work like C++, and won't start.
As far as sending UDTs as pointers, check out the Win32 API sometime.
Microsoft carefully avoided returning pointers to structs, or even
pointers to character arrays, specifically to avoid situations where
the *many* pointerless languages couldn't call functions.
You pass in a UDT ByRef, to be filled by the recipient.
Quote:
>Any thoughts greatly appreciated.

>Thanks.

>Colin Johnson.



Wed, 02 Aug 2000 03:00:00 GMT  
 Calling ActiveX control from VB

Ooooooooh, touchey.

I consider myself "TOLD" then :-)

Colin.



Sat, 05 Aug 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. calling VB activex control from VC

2. VB script calling activeX control problem

3. Calling VB ActiveX Control from MFC

4. Problem using VB 5 activex DLL in a VC++ activex control

5. MFC Control OnCreate not called via VB, but called under MSVC

6. VB ActiveX Control encapsulated within a VC Control

7. Call a C++ ActiveX method from a VB exe program

8. VB image list handle isn't fully accessible in VC++ ActiveX thru COM call

9. Atl NT service calling VB ActiveX dll had problem when clean-up

10. Problem with calling VB ActiveX from callback

11. How do you call VB ActiveX DLL functions from VC

12. Call/Use VB ActiveX Dll in Visual C

 

 
Powered by phpBB® Forum Software