Quote Originally Posted by jsvenu View Post
Dear Trick,


In the following attached activex exe code running standalone in modmain.bas we display fMain in modeless way

Code:
Sub Main()                              
    If App.TaskVisible Then fMain.Show  
End Sub
I add usercontrol to my activex exe standalone project thru Load User Control button as follows:

Code:
Private Sub Command1_Click()              
    Controls.Add("AxThreading.UserControl1", "Ctl1").Visible = True             'load usercontrol Control onto this ThreadForm
End Sub
When I click on the Load User Control button I get the following error in msgbox

---------------------------
AxThreading
---------------------------
Run-time error '720':

'AxThreading.UserControl1' is not a valid control type
---------------------------
OK
---------------------------





But when I make fMain to display in modal fashion as follows and click on the Load User Control button it works fine.

Sub Main()
If App.TaskVisible Then fMain.Show vbModal
End Sub


1. Please clarify how to make this activex exe application to work when fMain is displayed in modeless way.


When I click on Create and show an additional threaded Form button in the displayed form I get another instance of the same form displayed in new thread.

When I click on the Load User Control button in this new form I get the following error

---------------------------
AxThreading
---------------------------
Run-time error '339':

Component '' or one of its dependencies not correctly registered: a file is missing or invalid
---------------------------
OK
---------------------------

2. Please clarify how to make this work fine in this new form displayed in new thread.


regards,
JSVenu
Dear Trick,
For changing the activex exe to apartment model threading can we get vbheader of the activex exe in the same way as
standard exe using the same GetVBHeader function of modmultithreading module so that we can see that usercontrol works in main thread form and in new thread form.Please clarify.

regards,
JSVenu