Results 1 to 2 of 2

Thread: Constructor for ActiveX Control

  1. #1

    Thread Starter
    Fanatic Member alexandros's Avatar
    Join Date
    Oct 2002
    Location
    Milky Way Galaxy
    Posts
    694

    Constructor for ActiveX Control

    Is there a way to make a constructor for an activex object?

    For example i want to make an activex control that will be basically a simple usercontrol and it will take different shapes with the setwindowrgn api.

    Now i want to do something like this from my form
    VB Code:
    1. dim CIRCLE_VALUES as new Collection
    2. CIRCLE_VALUES.add 0  'x1
    3. CIRCLE_VALUES.add 0  'y1
    4. CIRCLE_VALUES.add 10 'x2
    5. CIRCLE_VALUES.add 10 'y2
    6.  
    7.  
    8.  
    9.  
    10. dim newctl=new ShapeUserControl("Circle",CIRCLE_VALUES)
    now when the ShapeUserControl is appearing on the form i want to do something like this:
    VB Code:
    1. if Shape_Type="Circle" then
    2.  
    3. hRgn=CreateEllipticRgn CIRCLE_VALUES.item(1),CIRCLE_VALUES.item(2) .........
    4. SetWindowRgn me.hwnd,hrgn,true
    5.  
    6. elseif Shape_Type="Polygon" then
    7.  
    8. hRgn=CreatePolygonRgn .....
    9. SetWindowRgn me.hwnd,hrgn,true

  2. #2
    Frenzied Member yrwyddfa's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    1,253
    You can 'simulate' constructors by

    (i) using COM+
    (ii) using C++

    COM+ exposes an interface that will allow you to create objects with parameters.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width