R
Roy Gunnarsson
Hello all,
I have a VERY simple windows application that decrypts data files we receive
from a partner. The decryption is handled by a COM component our partner
provided us with (thus we have no control over its functionality). That,
however, works fine. To make it a little easier for our end users, I wanted
to include a feature that places the path and name of the decrypted file on
the clipboard. I was going to do this by using
Clipboard.SetDataObject(sNamePath). However when I run the application, I
receive an error stating:
"The current thread must set to Single Thread Apartment (STA) mode before
OLE calls can be made. Ensure that your Main function has STAThreadAttribute
marked on it."
The error occurs on the Clipboard.SetDataObject line. I don't have a 'Main'
function (I tried putting a Main sub in with a Application.Run(Form1) and
mark it with the <STAThreadAttribute> but with no change).
I built another windows app just to test the Clipboard.SetDataObject and it
worked just fine...
I would be very grateful for some insight. I don't absolutely need this
feature, it just bugs me that it's not working and I don't know why.
Thanks,
Roy Gunnarsson
I have a VERY simple windows application that decrypts data files we receive
from a partner. The decryption is handled by a COM component our partner
provided us with (thus we have no control over its functionality). That,
however, works fine. To make it a little easier for our end users, I wanted
to include a feature that places the path and name of the decrypted file on
the clipboard. I was going to do this by using
Clipboard.SetDataObject(sNamePath). However when I run the application, I
receive an error stating:
"The current thread must set to Single Thread Apartment (STA) mode before
OLE calls can be made. Ensure that your Main function has STAThreadAttribute
marked on it."
The error occurs on the Clipboard.SetDataObject line. I don't have a 'Main'
function (I tried putting a Main sub in with a Application.Run(Form1) and
mark it with the <STAThreadAttribute> but with no change).
I built another windows app just to test the Clipboard.SetDataObject and it
worked just fine...
I would be very grateful for some insight. I don't absolutely need this
feature, it just bugs me that it's not working and I don't know why.
Thanks,
Roy Gunnarsson