NikiTo

Members
  • Content count

    7
  • Joined

  • Last visited

Community Reputation

163 Excellent

About NikiTo

  • Rank
    Newbie
  1. Thank you for the answer, @Nypyren! You suggested that the template is setting the threading for me. I was afraid to add STAThread and mess something, that's why I first tried what was easier- I just out-commented the CoInitializeEx in the constructor of the class that use COM and the CoUnitialize in the destructor and it is working without a problem. I hope it will not give me headaches in the future. COM seems enough tricky for me as to add to it the complexity of threading.
  2. My main project is a C# console application and it generates an exe. C# calls functions exported from a dll written in C++. I do nothing weird nowhere inside the code. The DllMain inside the dll is empty. When I try to call CoInitializeEx(null, COINIT_APARTMENTTHREADED) i get error: RPC_E_CHANGED_MODE. I never touch or use threads declarations, neither COM related stuff nowhere in the code. Who is declaring the model as MULTITHREADED and how should I deal with the problem? Should I somehow initialize the dll as single threaded? Do I need CoInitializeEx() at all? I am afraid to simply delete it to not break something on my computer.