I'm trying to make multi-threads.I got the error 249 : activex component can't create object. I'm not sure my steps correct or not. Someone please help me confirm with it.Thank you.
I open a new activex.exe project and copy this code into the class module.then i compiled this to project.exe.
Public Function addOne(x As Long) x = x + 1 addOne = x End Function
Then i open another project in standard.exe and copy this into a form and click on project to make project1.exe references to this standard.exe.Then i run my project.
Private Sub command1_click()
Set tc1 = CreateObject("Project1.ThreadClass")
For i = 1 To 20000000
DoEvents
Label1.Caption = tc1.addOne(i)
Label1.Refresh
Next
End Sub
Private Sub command2_click()
Set tc2 = CreateObject("Project1.ThreadClass")
For j = 1 To 20000000
DoEvents
Label2.Caption = tc2.addOne(j)
Label2.Refresh
Next
End Sub

New Topic/Question
Reply




MultiQuote


|