Hi,

I have an application which has browser control in it, i open this form and
it does some automated steps and closes it self every thing wrok so far.

Now wanted to open multiple instances of this form each of them running in
its own thread. But when i try to create this form within newly created
thread it gives me error (somthing like Activex control cannot be
instnciated in a worker thread etc)

any idea hint,

Thanks,
Sajjad

Re: Opening up windows form with muliple threads by Mattias

Mattias
Thu Sep 15 14:27:08 CDT 2005

>Now wanted to open multiple instances of this form each of them running in
>its own thread. But when i try to create this form within newly created
>thread it gives me error (somthing like Activex control cannot be
>instnciated in a worker thread etc)

Have you called Application.Run on the thread to pump messages?


Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

RE: Opening up windows form with muliple threads by v-jetan

v-jetan
Thu Sep 15 21:21:33 CDT 2005

Hi Sajjad,

Thanks for your post.

Yes, for Windows GUI application to live, we must provide a message loop
for it, then only when WM_QUIT comes, our application will reside in the
message loop without thread existed. Message loop is thread-specific, that
is if we create different forms on different threads, we have to provide
every thread a message loop.
Without having a message loop in the thread procedure, after creating the
form, the thread procedure will exist, so the form will not appear at all.

In .Net Winform, we can startup the message loop with Application.Run
method.

If this still does not resolve your problem, please provide some code
snippet for us to reproduce out your problem. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


Re: Opening up windows form with muliple threads by Sajjad

Sajjad
Sun Sep 18 09:54:05 CDT 2005

Thanks,

i tried with Application.Run and its working fine now.

Thanks for your help.

Sajjad


""Jeffrey Tan[MSFT]"" <v-jetan@online.microsoft.com> wrote in message
news:rXBbgVmuFHA.3552@TK2MSFTNGXA01.phx.gbl...
> Hi Sajjad,
>
> Thanks for your post.
>
> Yes, for Windows GUI application to live, we must provide a message loop
> for it, then only when WM_QUIT comes, our application will reside in the
> message loop without thread existed. Message loop is thread-specific, that
> is if we create different forms on different threads, we have to provide
> every thread a message loop.
> Without having a message loop in the thread procedure, after creating the
> form, the thread procedure will exist, so the form will not appear at all.
>
> In .Net Winform, we can startup the message loop with Application.Run
> method.
>
> If this still does not resolve your problem, please provide some code
> snippet for us to reproduce out your problem. Thanks
>
> Best regards,
> Jeffrey Tan
> Microsoft Online Partner Support
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
>



Re: Opening up windows form with muliple threads by v-jetan

v-jetan
Sun Sep 18 21:38:29 CDT 2005

You are welcome :-)

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.