Don't crash on WindowID()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

Fred, would a future release make WindowID() return -1 if there is no
current window in use, instead of the debugger stopping the app? See
my InputBox procedure at this URL to see the reason why:

viewtopic.php?t=2412

Thanks... :)


PB - Registered PureBasic Coder
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by tinman.
Originally posted by PB

Fred, would a future release make WindowID() return -1 if there is no current window in use, instead of the debugger stopping the app? See my InputBox procedure at this URL to see the reason why:
Wouldn't it make more sense to return 0? After all, it returns a pointer/handle to a window and 0 is always used as an invalid indicator.



--
It's not minimalist - I'm increasing efficiency by reducing input effort.
(Win98first ed. + SP1, PB3.40)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

> Wouldn't it make more sense to return 0? After all, it returns a
> pointer/handle to a window and 0 is always used as an invalid
> indicator.

You're right! When I made my request I confused it with the Window
ID number, ie. OpenWindow(#ID). So yes, a 0 would be better. :)


PB - Registered PureBasic Coder
Post Reply