-
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
-
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
-
How exactly would i use this code with an activex control?
-
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...