Hi Bob,
Thanks for posting in the community.
First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you have a C++ wrap for a
third-party dll, and you wants to P/Invoke the C++ wrap dll from DLL in
VB.NET, when called the dll in the MainThread it works, while it will get
error 126 when called in a working thread.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.
Is the VB.NET application a winform application?
Did the third-party dll have any requirements? e.g. if it needs a GUI
thread, a message queue and etc.
If so, it maynot work properly in the working thread.
What is it used for?
From your description, I think the design has no problem.
Please apply my suggestion above and let me know if it helps resolve your
problem.
Also, did you any cross-thread operation?e.g. you create an object in the
third-party dll from the Mainthread in the VB.NET and access it from the
working thread or vice versa.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.