Board index » delphi » How Get Char from wParam?

How Get Char from wParam?

What is the correct way to convert a Windows wParam to a Delphi Char?
Ord(wparam) works, but Ord is intended for a Byte argument,.
 

Re:How Get Char from wParam?


Quote
On Fri, 06 Sep 2002 17:30:34 GMT, s...@ieee.NOSPAM.org (Shel) wrote:
>What is the correct way to convert a Windows wParam to a Delphi Char?
>Ord(wparam) works, but Ord is intended for a Byte argument,.

procedure TForm1.Button1Click(Sender: TObject);
Var
  wParam:Integer;
  C:Char;
begin
  wParam := 64;
  C := Char(wParam);
  ShowMessage( String(C) );
end;

Re:How Get Char from wParam?


Quote
Shel wrote in message <3d78e648.6699...@news.earthlink.net>...
>What is the correct way to convert a Windows wParam to a Delphi Char?

Numbers are translated (re-interpreted, really) by feeding
them into the Chr function. Of course, wParam is longer then
the average Char type, so you may need to check that it's
in range, or ask for a WideChar or something.

Quote
>Ord(wparam) works, but Ord is intended for a Byte argument,.

No. Ord is intended for non-integer ordinal arguments. See
the other thread.

Groetjes,
Maarten Wiltink

Other Threads