1

Is there anyway to safely convert/typecast a string inside TEdit (an actual window handle for eg. 00010C10) into a handle LONGWORD data type I presume in Delphi/Lazarus.

Recommended method here Pascal - String to LongWord is IntToStr but compiler throws following error:

Exception class EConvertError with message '00010C10' is not a valid integer value

Also tried IntToStr64 but no luck....

0

1 Answer 1

8

It's because by default the StrToInt expects the string to be in decimal notation. To convert an hex notation string to integer prefix it with $, ie

intVal := StrToInt('$'+Edit1.Text);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.