Quote Originally Posted by jsvenu View Post
Dear Trick,

In the activex exe application supporting usercontrol once we display user control in additional thread forms when we close the application it is still running.Can you provide code for properly closing the application so that it closes properly.

Link: http://www.vbforums.com/attachment.p...1&d=1581403109

regards,
JSVenu
Dear Trick,

When I tried to use the following code for properly unloading still the application is running when I close the application after displaying a usercontrol by setting the form thread to apartment model.I had to use task manager to kill the running activex exe application.Please clarify.

Code:
Public Declare Function VBDllCanUnloadNow Lib "MSVBVM60.DLL" (ByVal pVbHeader As Long) As Long

Public Sub UnloadThreadedForm()
    If Not ThreadForm Is Nothing Then Unload ThreadForm: Set ThreadForm = Nothing
    ' // The runtime will call CThreadPool::CheckForProjectUnload and CVBThreadAction::CleanupProjData
    If VBDllCanUnloadNow(modMultiThreading.GetVBHeader) Then
        Exit Sub
    End If
End Sub
regards,
JSVenu