I am trying to open a form in a new window and I also want this window to be open even after closing the vb6 application. This is the code i am using
D开发者_Python百科im frmWB As frmErrWindow
Set frmWB = New frmErrWindow
frmWB.WBErrorWindow.RegisterAsBrowser = True
Set ppDisp = frmWB.WBErrorWindow.object
frmWB.Show
Thanks in advance.
Any forms and objects you create from VB6 will be closed when the application closes, because they exist within the process memory space. The only way to keep a window open after your application closes (that I know of) is to use DLL injection to put your code into a foreign process. That way, your VB6 app could exit and the DLL in the external process would remain running.
Unfortunately, DLL injection is not possible using VB6 alone.
To do this you need to package the form and it's functionality into another exe then pass any messages to this new exe using COM automation or simply as a command line argument. You can then shell and run the new executable. This is the only way that you can keep something on the screen after the program's process closes. DLL's asociated with your application run in the same memory space as the application and are released when your application closes.
I used an IE object to open the form in a new window and this worked for me.
精彩评论