Re: [fpc-pascal]Win32 API Call

2004-06-24 Thread Matt Emson
> Summing it up: you have to use LongBool (or Windows.Bool) when > translating WinAPI functions that take or return BOOL type. Boolean is > not correct, even if it sometimes works. Actually, you're right up to a point. You should return BOOL, but a Boolean value will auto convert when assigned a B

Re: [fpc-pascal]Win32 API Call

2004-06-24 Thread Michalis Kamburelis
Matt Emson wrote: ... It should be boolean. All Win32API return values which are BOOL translate as Boolean. That's not true. WinAPI uses BOOL type, it's defined in WinAPI headers as typedef int WINBOOL,*PWINBOOL,*LPWINBOOL; ... typedef WINBOOL BOOL; So BOOL is int. So it's 32-bit value on 32-

Re: [fpc-pascal]Win32 API Call

2004-06-23 Thread Matt Emson
> > To be fair to you, FPC should have always used StdCall for Win32API calls. > > It would be less confusing now, anyway. > > FPC always did add stdcall, since FPC didn't use stdcall by default, but > what now is "oldfpccall" in 1.9.x. > > However policy was and is to flag them as stdcall. A

Re: [fpc-pascal]Win32 API Call

2004-06-23 Thread Marco van de Voort
> > >4. This is not important for FPC 1.0.x, but for newer FPC remember to > > >declare WinAPI functions as "stdcall" (FPC 1.0.x just used "stdcall" by > > >default). > > > > I'll make note of that. > > To be fair to you, FPC should have always used StdCall for Win32API calls. > It would be less

Re: [fpc-pascal]Win32 API Call

2004-06-22 Thread Matt Emson
> That's awfully odd, because according to the Win32 API reference the > function GetCurrentHwProfile requires a pointer, which pProfileInfo is > (tProfileInfo is just the type definition). Guess I have some more reading > to do. No, it makes a lot of sense. You could use: (var value: TProfil

Re: [fpc-pascal]Win32 API Call

2004-06-22 Thread Michalis Kamburelis
Jim Wilson wrote: At 12:00 AM 6/22/2004, you wrote: You made a few mistakes translating GetCurrentHwProfile to Pascal: Figures it was me... :-) 1. parameter to GetCurrentHwProfile should be TProfileInfo, not PProfileInfo (using "var" parameter already forces passing HWProfile by reference) Tha

Re: [fpc-pascal]Win32 API Call

2004-06-22 Thread Jim Wilson
At 12:00 AM 6/22/2004, you wrote: You made a few mistakes translating GetCurrentHwProfile to Pascal: Figures it was me... :-) 1. parameter to GetCurrentHwProfile should be TProfileInfo, not PProfileInfo (using "var" parameter already forces passing HWProfile by reference) That's awfully odd, bec

Re: [fpc-pascal]Win32 API Call

2004-06-21 Thread Peter Vreman
> I'm trying to get a Win32 API call to work, but either I found a bug in > FPC > (not likely) or I'm doing something wrong (more then likely). > > There's an API function called GetCurrentHwProfile that doesn't seem to be > recognized by FPC, so I added it myself using external. However, when I >

Re: [fpc-pascal]Win32 API Call

2004-06-21 Thread Michalis Kamburelis
Hi You made a few mistakes translating GetCurrentHwProfile to Pascal: 1. parameter to GetCurrentHwProfile should be TProfileInfo, not PProfileInfo (using "var" parameter already forces passing HWProfile by reference) 2. result of GetCurrentHwProfile should be LongBool (4 bytes), not boolean (1

[fpc-pascal]Win32 API Call

2004-06-21 Thread Jim Wilson
I'm trying to get a Win32 API call to work, but either I found a bug in FPC (not likely) or I'm doing something wrong (more then likely). There's an API function called GetCurrentHwProfile that doesn't seem to be recognized by FPC, so I added it myself using external. However, when I try callin