c# - Clipboard doesn't work when I load my main executable assembly manually -
i have c# project running vc++ project. i've used clipboard
in c# project; when i'm running c# project vc++ doesn't work properly.
my c# code:
idataobject dataobject = clipboard.getdataobject(); if (dataobject.getdatapresent("mytype",true)) //this returns true in both of cases console.writeline("here"); object obj = dataobject.getdata("mytype"); //obj null mytype data = obj mytype; // when copy data normal program called program (from vc++) null
apparently can not use clipboard
in projects not stathread
. entry point of c# project stathread
don't know how can make vc++ project stathread
?
edit: application.olerequired() == apartmentstate.sta
returns true
, thread stathread
.
just add above main [system::stathread]
Comments
Post a Comment