Sign in to follow this  
Stukey

[.net] Directx Visual Basic .net unsafe thread graphics form problem

Recommended Posts

In my project I have a startup form, which starts a thread which is supposed to basically run the game (including update graphics) problem is for initializing graphics I need to give it a target form and I get an unsafe thread exception for using the form on a thread it was not declared in. I'm under the impression that this is a good thing and I shouldn't just toss the exception, or is that wrong because directx shouldn't affect any part of the form that would cause problems? Is there an easier way to fix this than move the graphics code into the form? If I do that then all of the objects the graphics renders will be based on cross thread reads and therefore a pain.

Share this post


Link to post
Share on other sites
Hmm, thanks, I actually used that tutorial to do my custom console, and I didn't think it could fix the problem I had because the exception was occuring on the line

d3dPP.DeviceWindow = target_form

but that was somehow incorrect because the problem was that my function for hiding the Panel for login controls was throwing the error and after I fixed the hide line the line I showed stopped throwing and exception too.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this