PC Review


Reply
Thread Tools Rate Thread

Bitmaps and threading model

 
 
WRH
Guest
Posts: n/a
 
      9th Feb 2005
Hello
I have a Form where I display DirectX Direct3D stuff on one panel
and a WebBrowser in another. Compiles & runs fine until I add
one line...

private Bitmap bmpForm= new Bitmap(typeof(Form1), "frame5.bmp");

Compiles ok, but does not run... I get a System Thread Exception
where I instantiate the web browser...
"Could not instantiate ActiveX because the current thread is
not in a single-threaded apartment".

Does loading a Bitmap change the threading model? What should
I do to get my bitmap?


 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      9th Feb 2005
WRH,

I wouldn't create the bitmap in the declaration. Rather, try it when
the form loads, after the window and the webbrowser control is created.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

"WRH" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello
> I have a Form where I display DirectX Direct3D stuff on one panel
> and a WebBrowser in another. Compiles & runs fine until I add
> one line...
>
> private Bitmap bmpForm= new Bitmap(typeof(Form1), "frame5.bmp");
>
> Compiles ok, but does not run... I get a System Thread Exception
> where I instantiate the web browser...
> "Could not instantiate ActiveX because the current thread is
> not in a single-threaded apartment".
>
> Does loading a Bitmap change the threading model? What should
> I do to get my bitmap?
>
>



 
Reply With Quote
 
WRH
Guest
Posts: n/a
 
      10th Feb 2005
That did the trick! Thanks.

"Nicholas Paldino [.NET/C# MVP]" <(E-Mail Removed)> wrote in
message news:%(E-Mail Removed)...
> WRH,
>
> I wouldn't create the bitmap in the declaration. Rather, try it when
> the form loads, after the window and the webbrowser control is created.
>
> Hope this helps.
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - (E-Mail Removed)
>
> "WRH" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hello
>> I have a Form where I display DirectX Direct3D stuff on one panel
>> and a WebBrowser in another. Compiles & runs fine until I add
>> one line...
>>
>> private Bitmap bmpForm= new Bitmap(typeof(Form1), "frame5.bmp");
>>
>> Compiles ok, but does not run... I get a System Thread Exception
>> where I instantiate the web browser...
>> "Could not instantiate ActiveX because the current thread is
>> not in a single-threaded apartment".
>>
>> Does loading a Bitmap change the threading model? What should
>> I do to get my bitmap?
>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
.NET COM threading model Martin Plechsmid Microsoft Dot NET Framework 2 4th Dec 2009 05:44 AM
What is the threading model for WCF services? Tom P. Microsoft C# .NET 4 15th May 2009 06:55 PM
What is the threading model for WCF services? Tom P. Microsoft C# .NET 0 15th May 2009 01:18 PM
WPF Threading Model Yehia A.Salam Microsoft C# .NET 5 25th May 2007 10:02 PM
Specifying the threading model of a .NET class =?Utf-8?B?SnVhbiBEZW50?= Microsoft Dot NET Framework 4 3rd Aug 2005 09:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:16 AM.