Hi,
I have a program that uses Win32::GUI, and in several places, it uses a
DoEvents loop, and text boxes processed by that DoEvents loop seem to
result in doubled characters. I don't recall that happening in earlier
versions of Win32::GUI, does anyone else?
So I recompiled Win32::GUI with several of the debug #defines in place,
and started reading Win32::GUI code. I've not been a creater of Windows
programs before Win32::GUI, so I'm not real familiar with the Windows
API, but it is documented, sort of. So I figure debugging this will be
a good learning experience to get me somewhat familiar with the Windows
API, intensely familiar with Win32::GUI, somewhat familiar with XS, and
perhaps able to contribute to its development.
So first I had to figure out the message loop(s), since that is where
all the action happens first. I notice that there is a discrepancy
between the message handling in Win32::GUI::Dialog vs
Win32::GUI::DoEvents vs Win32::GUI::DoModal.
The message handling logic flow in all three procedures is very similar
(and perhaps should be abstracted into a single procedure for ease of
maintenance... maybe it wasn't because this is XS? I don't speak XS
well, either)
I notice that the logic flow includes 3 local variables: perlud,
fIsDialog, and acc, that I wish to discuss here. Before setting perlud,
fIsDialog and acc are both set to zero. After calculated perlud, if it
validates, then fIsDialog is extracted from the dwPlStyle field. In
DoEvents alone, the acc variable is also set in this block. In Dialog
and DoModal, the local variable "acc" is not set, hence being left at
NULL. However, the logic after that, identical in all three places, has
two tests for (acc != NULL) which will never be true in Dialog or DoModal.
It would appear that this could be a reason for accelerator keys not
functioning in many circumstances?
Or is it just extraneous code, and a bug in DoEvents?
N.B. It seems that the code in Win32::GUI 0.0.558 was more complex (also
checking a -accel key) for calculating the local variable "acc", but it
did exist in both of them. DoModal didn't exist in 558, of course.
--
Glenn
=====
Not everything that is counted counts,
and not everything that counts can be counted.
-- A. Einstein