From: Glenn L. <pe...@ne...> - 2003-12-10 20:12:29
|
YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU I still had a test case, and this DOES solve the keyboard entry jitter problem. Laurent, if this also cures Steve's mouse down problem, I think it is time to make an official distribution. We've fixed a number of significant bugs and missing features, of which this is the most significant. So we should make it possible for people to use these fixes easily, and put out a new version of Win32::GUI. I guess the biggest issue is what version number to give it, but Aldo said his next version would be 1.xxx, so any old 0.0.VVV for VVV > 665 would work to allow people to upgrade. On approximately 12/10/2003 11:32 AM, came the following characters from the keyboard of Laurent ROCHER: >>Glenn Linderman wrote: >> >>>But I think if you use Win32::API to call call PeekMessage with the >>>PM_REMOVE set, that you may not get the repeated behavior... me thinks >>>the bug is inside DoEvents, somehow.... it just hit me... maybe the >>>PM_REMOVE constant is wrong? (Pure speculation here, but something is >>>wrong, and it isn't obvious.) >> >>no, the PM_REMOVE seems to be correct. I also tried to debug this one >>really hard, to no avail. >> > > > I think problem come from use of PeekMessage return value. > > PeekMessage Return Values: > If a message is available, the return value is nonzero. > If no messages are available, the return value is zero. > > In current DoEvents code, when PeekMessage return 0, loop exit only > after proceding last MSG. > > while(stayhere) { > stayhere = PeekMessage(&msg, hwnd, 0, 0, PM_REMOVE); > #ifdef PERLWIN32GUI_STRONGDEBUG > printf("XS(DoEvents): PeekMessage returned %d\n", stayhere); > #endif > if(msg.message == WM_EXITLOOP) { > stayhere = 0; > msg.wParam = (WPARAM) -1; > } else { > if(stayhere == -1) { > stayhere = 0; > msg.wParam = (WPARAM) -2; // an error occurred... > } > else { > ... > } > } > } > > I think code below resolve double event call. > > Laurent > > > ########################################################################### > # (@)METHOD:DoEvents() > DWORD > DoEvents(hwnd=NULL) > HWND hwnd > PREINIT: > MSG msg; > HWND phwnd; > HWND thwnd; > int stayhere; > BOOL fIsDialog; > HACCEL acc; > LPPERLWIN32GUI_USERDATA perlud; > CODE: > stayhere = 1; > fIsDialog = FALSE; > while(stayhere) { > stayhere = PeekMessage(&msg, hwnd, 0, 0, PM_REMOVE); > #ifdef PERLWIN32GUI_STRONGDEBUG > printf("XS(DoEvents): PeekMessage returned %d\n", stayhere); > #endif > if (stayhere) { > if(msg.message == WM_EXITLOOP) { > stayhere = 0; > msg.wParam = (WPARAM) -1; > } else { > // #### trace back to the window's parent > phwnd = msg.hwnd; > while(thwnd = GetParent(phwnd)) { > phwnd = thwnd; > } > // #### now see if the parent window is a DialogBox > fIsDialog = FALSE; > acc = NULL; > perlud = (LPPERLWIN32GUI_USERDATA) GetWindowLong(phwnd, > GWL_USERDATA); > if( ValidUserData(perlud) ) { > fIsDialog = perlud->dwPlStyle & PERLWIN32GUI_DIALOGUI; > acc = perlud->hAcc; > } > > if(acc && TranslateAccelerator(phwnd, acc, &msg)) > continue; > > if(fIsDialog && IsDialogMessage(phwnd, &msg)) > continue; > > TranslateMessage(&msg); > DispatchMessage(&msg); > } > } > else > msg.wParam = (WPARAM) 0; > } > RETVAL = msg.wParam; > OUTPUT: > RETVAL > > > -- Glenn -- http://nevcal.com/ =========================== Like almost everyone, I receive a lot of spam every day, much of it offering to help me get out of debt or get rich quick. It's ridiculous. -- Bill Gates And here is why it is ridiculous: The division that includes Windows posted an operating profit of $2.26 billion on revenue of $2.81 billion. --from Reuters via http://biz.yahoo.com/rc/031113/tech_microsoft_msn_1.html So that's profit of over 400% of investment... with a bit more investment in Windows technology, particularly in the area of reliability, the profit percentage might go down, but so might the bugs and security problems? Seems like it would be a reasonable tradeoff. WalMart earnings are 3.4% of investment. |