Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2005-08

Windows Type LPARAM, WPARAM

8 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Urbansound

Hi,

I've been working with FPC 2.0.0 and Dev-Pas for some GUI efforts and another programmer pointed out an interesting thing, regarding the LPARAM and WPARAM types. I hope I'm not kicking up old dust, but for the sake of clarification if we may...

The Microsoft architecture affiliates these two keywords as "Types", based upon case sensitivity, among the variouse usage they apply from a C perspectieve, where in Pascal, case is insensitive. In Dev-Pas' gui template, they assign these same words as follows...

//---------
function WindowProc(Window: HWnd; AMessage, WParam,
          LParam: Longint): Longint; stdcall; export;

LParam becomes Longint, but it is a TYPE actually.

Without case sensitivity in Pascal, these same words can become declared variables as above, which leads to ambiguous code.

//----------
Consider the useage otherwise as ...
function WindowProc(Window: HWnd; AMessage: UINT; WParam : WPARAM;
                    LParam: LPARAM): LRESULT; stdcall; export;

In hopes of avoiding a discussion on the merits of case-sensitivity in compiler design... Is there any way to switch on case sensitivity or otherwise a switch to have references become reserved words, such that their case insensitive nature can be raised as an error in the above cases? LPARAM AND WPARAM are consistently present in most windows usage.

i.e. LParam: Longint > would raise an error for reserved word. LParam:LPARAM > would raise an error as a redundant cast

xxx:Lparm would cast xxx to any case manner of Lparam/Wparam

I suppose that there are a number of cased words in Windows that make the consideration impractical overall, but is this strictly a manner of managment on the programmers behalf, to watch declarations and scope closely, or could it ever be managed as a switched option?

Thanks in advance,

Mike

Urbansound
to Urbansound

Please ignore this. FPC has generated this as an error. This is an old discussion from August

Earlier message 45 lines
----- Original Message ----- From: Urbansound To: Sent: Tuesday, August 16, 2005 9:25 PM Subject: [fpc-pascal] Windows Type LPARAM, WPARAM Hi, I've been working with FPC 2.0.0 and Dev-Pas for some GUI efforts and another programmer pointed out an interesting thing, regarding the LPARAM and WPARAM types. I hope I'm not kicking up old dust, but for the sake of clarification if we may... The Microsoft architecture affiliates these two keywords as "Types", based upon case sensitivity, among the variouse usage they apply from a C perspectieve, where in Pascal, case is insensitive. In Dev-Pas' gui template, they assign these same words as follows... //--------- function WindowProc(Window: HWnd; AMessage, WParam, LParam: Longint): Longint; stdcall; export; LParam becomes Longint, but it is a TYPE actually. Without case sensitivity in Pascal, these same words can become declared variables as above, which leads to ambiguous code. //---------- Consider the useage otherwise as ... function WindowProc(Window: HWnd; AMessage: UINT; WParam : WPARAM; LParam: LPARAM): LRESULT; stdcall; export; In hopes of avoiding a discussion on the merits of case-sensitivity in compiler design... Is there any way to switch on case sensitivity or otherwise a switch to have references become reserved words, such that their case insensitive nature can be raised as an error in the above cases? LPARAM AND WPARAM are consistently present in most windows usage. i.e. LParam: Longint > would raise an error for reserved word. LParam:LPARAM > would raise an error as a redundant cast xxx:Lparm would cast xxx to any case manner of Lparam/Wparam I suppose that there are a number of cased words in Windows that make the consideration impractical overall, but is this strictly a manner of managment on the programmers behalf, to watch declarations and scope closely, or could it ever be managed as a switched option? Thanks in advance, Mike ------------------------------------------------------------------------------
Michael Van Canneyt
to Urbansound: I've been working with FPC 2.0.0 and Dev-Pas for some GUI efforts and another programmer…
Urbansound wrote 22 lines
Hi, I've been working with FPC 2.0.0 and Dev-Pas for some GUI efforts and another programmer pointed out an interesting thing, regarding the LPARAM and WPARAM types. I hope I'm not kicking up old dust, but for the sake of clarification if we may... The Microsoft architecture affiliates these two keywords as "Types", based upon case sensitivity, among the variouse usage they apply from a C perspectieve, where in Pascal, case is insensitive. In Dev-Pas' gui template, they assign these same words as follows... //--------- function WindowProc(Window: HWnd; AMessage, WParam, LParam: Longint): Longint; stdcall; export; LParam becomes Longint, but it is a TYPE actually. Without case sensitivity in Pascal, these same words can become declared variables as above, which leads to ambiguous code. //---------- Consider the useage otherwise as ... function WindowProc(Window: HWnd; AMessage: UINT; WParam : WPARAM; LParam: LPARAM): LRESULT; stdcall; export; In hopes of avoiding a discussion on the merits of case-sensitivity in compiler design... Is there any way to switch on case sensitivity or otherwise a switch to have references become reserved words, such that their case insensitive nature can be raised as an error in the above cases? LPARAM AND WPARAM are consistently present in most windows usage.

Pascal is case insensitive, and that will not change any time soon, if ever. 99.99% of all code out there would stop working if it was made case sensitive.

Michael.

Alain Michaud
to Urbansound: I've been working with FPC 2.0.0 and Dev-Pas for some GUI efforts and another programmer…

Hi,

Someone could please help me with this:

the simple console program (linux):

prog1 --arg1 123

prints the result 123:

prog1 --arg 123

123

now I write another program 'prog2' that has the line:

fpExecv('prog1',pp);

where

pp[0] <-- 'prog1'
pp[1] <-- '--arg'
pp[2] <-- '123'

If I run this second program, it will print the standard otput to the console:

prog2

123

Question: what should I do to redirect ("pipe") the output "123" into the program "prog2" and not print it? Is it possible?

Thank you

Alain Michaud

L505
to Alain Michaud
Show quoted text 5 lines
Question: what should I do to redirect ("pipe") the output "123" into the program "prog2" and not print it? Is it possible? Alain Michaud

Have you seen "AssignStream()".
You can grab the piped output without it printing off on you.

There are more ways to do it if you want more cross platform, let us know.

Alain Michaud
to L505

Hi,

this is exactly what I was looking for. Thank you very much.

I have one concern however: This procedure is part of the "oldlinux" unit. Has it been relocated? Should I still use it?

Thanks

Alain

L505 wrote 16 lines
> Question: what should I do to redirect ("pipe") the output "123" into > the program "prog2" and not print it? Is it possible? > > Alain Michaud > Have you seen "AssignStream()". You can grab the piped output without it printing off on you. There are more ways to do it if you want more cross platform, let us know. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Marco van de Voort
to Alain Michaud
this is exactly what I was looking for. Thank you very much. I have one concern however: This procedure is part of the "oldlinux" unit. Has it been relocated? Should I still use it?

No, but you can use the one in unit unix.

Alain Michaud
to Marco van de Voort

Ho,

my mistake! I did not see it.

It is unfortunate that the index tools does not scan in all the RTL units at once, but just unit by unit.

Thank you again

Alain

Marco van de Voort wrote 9 lines
> this is exactly what I was looking for. Thank you very much. > > I have one concern however: This procedure is part of the "oldlinux" > unit. Has it been relocated? Should I still use it? No, but you can use the one in unit unix. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal