[fpc-pascal]More strangeness...

Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Fri Aug 29 15:37:51 CEST 2003

On Fri, 29 Aug 2003, L D Blake wrote:

> 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.

It could be the handle which is passed on the lost focus event.

> > 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.

That, in combination with 'focus lost' may be worth looking at?

> 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.

Yes. I have had to fix them on several occasions myself.

> 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.

Unfortunately, the Windows unit is very basic. Short of the system unit,
almost all other RTL units are based on it. You have no choice but to
compile the RTL, using make...


More information about the fpc-pascal mailing list