If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
-
sms91
- Knows some wx things

- Posts: 32
- Joined: Tue Sep 09, 2008 5:26 am
- Location: China
Post
by sms91 » Thu Mar 05, 2009 1:57 am
Code: Select all
#define WX_REFRESH_GUI 10001
//...
void* wxMyThread::Entry()
{
//...
while(g_bRun)
{
for( //...)
{
//...
wxCommandEvent CommandEvent( wxEVT_COMMAND_MENU_SELECTED , WX_REFRESH_GUI ) ;
wxPostEvent( m_pUpdateHdr , CommandEvent ) ;
}
Sleep( 3000 ) ;
}
return NULL ;
}
if the program run a long time , i can see the DebugView print a lot of this infomation:\wxWidgets-2.8.8\wxWidgets-2.8.8\src\msw\app.cpp(562): 'PostMessage(WM_NULL)' failed with error 0x00000718 .
and the CPU 95%
EDIT by Auria : Please use code tags
-
computerquip
- Experienced Solver

- Posts: 72
- Joined: Fri Feb 20, 2009 7:13 pm
- Location: $(#wx)\src
Post
by computerquip » Thu Mar 05, 2009 2:07 am
lmfao...This is the code inside app.cpp that causes this error.
Code: Select all
void wxApp::WakeUpIdle()
{
// Send the top window a dummy message so idle handler processing will
// start up again. Doing it this way ensures that the idle handler
// wakes up in the right thread (see also wxWakeUpMainThread() which does
// the same for the main app thread only)
wxWindow * const topWindow = wxTheApp->GetTopWindow();
if ( topWindow )
{
HWND hwndTop = GetHwndOf(topWindow);
// Do not post WM_NULL if there's already a pending WM_NULL to avoid
// overflowing the message queue.
//
// Notice that due to a limitation of PeekMessage() API (which handles
// 0,0 range specially), we have to check the range from 0-1 instead.
// This still makes it possible to overflow the queue with WM_NULLs by
// interspersing the calles to WakeUpIdle() with windows creation but
// it should be rather hard to do it accidentally.
MSG msg;
if ( !::PeekMessage(&msg, hwndTop, 0, 1, PM_NOREMOVE) ||
::PeekMessage(&msg, hwndTop, 1, 1, PM_NOREMOVE) )
{
if ( !::PostMessage(hwndTop, WM_NULL, 0, 0) )
{
// should never happen
wxLogLastError(wxT("PostMessage(WM_NULL)"));
}
}
}
}
Last edited by
computerquip on Thu Mar 05, 2009 2:37 am, edited 6 times in total.
-
Auria
- Site Admin

- Posts: 6695
- Joined: Thu Sep 28, 2006 12:23 am
-
Contact:
Post
by Auria » Thu Mar 05, 2009 2:09 am
With some googling i found this :
Maybe it's a start?
-
sms91
- Knows some wx things

- Posts: 32
- Joined: Tue Sep 09, 2008 5:26 am
- Location: China
Post
by sms91 » Thu Mar 05, 2009 6:32 am
Auria wrote:With some googling i found this :
Maybe it's a start?
I have not use PostMessage(WM_NULL) , but the wxwidgets use the PostMessage(WM_NULL)
-
computerquip
- Experienced Solver

- Posts: 72
- Joined: Fri Feb 20, 2009 7:13 pm
- Location: $(#wx)\src
Post
by computerquip » Thu Mar 05, 2009 2:47 pm
The problem is addressed inside the app.cpp code. the message you are getting should literally never happen. When that is called it means that the PostMessage function failed. If you look it up in the MSDN,
HERE, you will find a little bit information that you may find will help you. It seems that this sometimes has a problem with Vista or later. Try running the app in administrator mode.
-
sms91
- Knows some wx things

- Posts: 32
- Joined: Tue Sep 09, 2008 5:26 am
- Location: China
Post
by sms91 » Fri Mar 13, 2009 1:26 am
I had add this code:
Code: Select all
WXLRESULT MyFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{
if ( message == WM_NULL )
{
wxGetApp().ProcessPendingEvents() ;
}
return wxFrame::MSWWindowProc( message , wParam , lParam ) ;
}