Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Adrian M
|
Apr 12, 2008 - 2:51 PM
|
My code resides in a dll. Here, I create a new thread where I instantiate a prof-uis based dialog class, with a bunch of controls. One of the controls is a popup menu button. When I open the menu associated with this button and press the Insert or Delete key, I get an assert/crash in the prof-uis code. I traced this to these lines in extpopupmenuwnd.cpp line 17559:
HKL hKeyboardLayout = ::GetKeyboardLayout( ( ::AfxGetThread() ) -> m_nThreadID );
Basically, m_nThreadID is 0, I’m assuming since it’s trying to get the id of the main thread, while running in a different thead. I get similar crashes in other cases, but they all seem to be cause by this threading issue. Any idea how to fix this? Thanks, Adrian
|
|
Adrian M
|
Apr 13, 2008 - 12:27 PM
|
It turns out that I was starting the thread using beginThreadEx when I should have used AfxBeginThread. I changed the code accordingly and that fixed the crash. Adrian
|
|