Page 1 of 1

GetProperty("Window", "HANDLE")

Posted: Sat Dec 03, 2016 9:11 pm
by KDJ
If a window is not defined, GetProperty("WindowName", "HANDLE") causes run-time error.
Maybe in this case the function should return 0?

Now in event handler I am using:
IF IsWindowDefined("WindowName") .and. (nHWnd == GetProperty("WindowName", "HANDLE"))
...
ENDIF

It could be shortened:
IF nHWnd == GetProperty("WindowName", "HANDLE")
...
ENDIF

Re: GetProperty("Window", "HANDLE")

Posted: Sat Dec 03, 2016 10:06 pm
by srvet_claudio
It is the responsibility of the programmer to check if the window/control is defined. All properties produces runtime error if a control or window is not defined.

The default return values when a programming error occurs at runtime generate black boxes in the code that are difficult to debug. A well written code can never produce an execution error, this last one more that a complication is a help and insurance for the programmer.

Re: GetProperty("Window", "HANDLE")

Posted: Sun Dec 04, 2016 7:28 pm
by KDJ
Claudio, thank you very much for your explanation.