Results 1 to 4 of 4

Thread: CreateObject() and ActiveX ocx

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2000
    Posts
    34

    Question

    does anyone know how to display a visual activex control dynamically at runtime. I have tried using the CreateObject() method and this created an instance of the control, but there was no way i could display the control on a form. Remember i want to do this all at runtime so i dont want to set any references to the control in the development IDE. I.e i want to use late-binding to display the control.

    Thanks alot


  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Try using the SetParent function:
    Code:
    Declare Function SetParent Lib "user32" Alias "SetParent" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
    Then, use the ShowWindow function on it:
    Code:
    Declare Function ShowWindow Lib "user32" Alias "ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2000
    Posts
    34
    How exactly would i use this code with an activex control?

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    You'd need to supply the hWnd of the control. However, if this property is not available from the control, I don't think there is a way. Although if anyone with VB6 knows if the new dynamic-creation method will work in this case...
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

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