[fpc-pascal]More strangeness...

L D Blake ldblake at sympatico.ca
Fri Aug 29 15:07:20 CEST 2003


In reply to your message of August 29, 2003
> Do you catch the 'focus lost' event ? Do you have any assembler ?
> Windows expects some registers to be saved.

No and no.  But come to think of it that's about when the problem is occuring.


> Are the winproc routines declared as stdcall ?

Yes.


> Did you go over all the WinAPI calls that you use ?

Twice now.  But will do it again.


> I know this is a tedious job, but it is one which needs to be done in
> such cases. We've had other cases where the declaration was wrong.

I've followed the SDK very closely, but mistakes do happen...


> The fact that huge projects as Lazarus work fine, make me believe that
> the error is win32 specific, and this points to the Windows unit or some
> special routines uses in mmsystem or whatever.

Yep, I took a look at the windows unit last night, found the bulk of type
declarations were in BASE.INC and noticed, almost right away, that "Handle" a
32 bit unsigned value is declared as a longint. Shouldn't it be a LongWord? A
longint has only half as many positive values as a longword and a
high-numbered handle could be causing the range checking error.

I also found a lot of places in Base.inc where longint has been substituted
for other variable types (byte, word, longword, etc) often complete with the
necessary wrangling to get the byte or word back out of the longint inside the
procedures. A quick text search found over 1000 lines with references to
"longint" in the windows unit, some lines have multiple references ... all of
which are now suspect.

I wasn't able to get a test compile out of the unit last night (it bombs out
at line 255 of Base.inc, in the "enumeratons" section) and there's no point
swimming through all that code until I do.

If anyone knows the correct setup for re-compiling the windows and mmsystem
units could you please let me know... Thanks.

-----
 L D Blake





More information about the fpc-pascal mailing list