kkirtac Posted May 23, 2006 Posted May 23, 2006 hi, i m developing a windows forms application using MC++, when i do debug the project , it fails in the line of ' openFileDialog1->ShowDialog(); ' and gives an error like that : An unhandled exception of type 'System.Threading.ThreadStateException' occurred in System.Windows.Forms.dll Additional information: Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process. But its already done in Form1.cpp like that : System::Threading::Thread::CurrentThread->ApartmentState = System::Threading::ApartmentState::STA; i mean the current apartmentstate is already set as STA... i cant debug the project cos of that error... Quote
kkirtac Posted May 24, 2006 Author Posted May 24, 2006 well, i added [sTAThreadAttribute] just above the main function and it did solve the problem..good luck Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.