473,383 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Bitmaps and threading model

WRH
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?
Nov 16 '05 #1
2 1272
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]
- mv*@spam.guard.caspershouse.com

"WRH" <no**********@videotron.ca> wrote in message
news:uj**************@tk2msftngp13.phx.gbl...
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?

Nov 16 '05 #2
WRH
That did the trick! Thanks.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2****************@TK2MSFTNGP12.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

"WRH" <no**********@videotron.ca> wrote in message
news:uj**************@tk2msftngp13.phx.gbl...
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?


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

65
by: Anthony_Barker | last post by:
I have been reading a book about the evolution of the Basic programming language. The author states that Basic - particularly Microsoft's version is full of compromises which crept in along the...
19
by: Jane Austine | last post by:
As far as I know python's threading module models after Java's. However, I can't find something equivalent to Java's interrupt and isInterrupted methods, along with InterruptedException....
12
by: Gurpreet Sachdeva | last post by:
I have written a code to figure out the difference in excecution time of a func before and after using threading... #!/usr/bin/env python import threading import time loops =
8
by: Mahesh Devjibhai Dhola [MVP] | last post by:
We are building Chat like application using Forms and as a result our programming is becoming complicated to display messages received on different threads in the chat window (due to STA...
4
by: Sascha Kerschhofer | last post by:
Hello everyone, does somebody knows how I can extract Bitmaps from a Powerpoint file (one per slide)? I found some ressources which opens Powerpoint as application and controls it...
0
by: Carly | last post by:
Hi, I am not sure I understand what is the meaning of "Execution of asynchronous code is not supported in Windows Forms threading model" - since I am able to create threads and run asynchronous...
0
by: =?Utf-8?B?VGlt?= | last post by:
I have written both a client (SoapClient) and server (SoapServer) application using WSE 3.0 with the TCP transport. These are completely standalone applications (the Server runs as a Windows...
5
by: skunkwerk | last post by:
i'm getting the wrong output for the 'title' attributes for this data. the queue holds a data structure (item name, position, and list to store results in). each thread takes in an item name and...
126
by: Dann Corbit | last post by:
Rather than create a new way of doing things: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2497.html why not just pick up ACE into the existing standard:...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.