Page 1 of 1

Inverse WindowID()

Posted: Fri Jul 06, 2007 3:46 pm
by Zizaco
There is to do the inverse of WindowID()?
To find the #Window from the Handle?

Please help.

Posted: Fri Jul 06, 2007 3:51 pm
by milan1612
Interesting question! Fred? Freeeeeeed... :D

Posted: Fri Jul 06, 2007 5:01 pm
by Heathen
I really don't think it's possible without keeping track of it yourself.. Although, I could be wrong.. ;)

Posted: Fri Jul 06, 2007 5:23 pm
by hallodri
For Window try this :

Code: Select all

debug GetProp_(hWnd,"PB_WindowID") -1
For Gadget :

Code: Select all

debug GetProp_(hWnd,"PB_ID")
;or 
debug GetDlgCtrlID_(hWnd)

Posted: Fri Jul 06, 2007 5:25 pm
by codemaniac
Not possible.

The hWnd (WindowID) is a WinAPI and OS exclusive handle, while the #Window in PureBasic is exclusive to PureBasic. If it would be possible to get the PureBasic #Window from a hWnd, that would mean all applications including non-PureBasic applications would have a #Window, but that is ofcourse impossible, because the hWnd's weren't created by PureBasic and so it can't get exclusive access to them.

Posted: Fri Jul 06, 2007 5:41 pm
by milan1612

Code: Select all

GetProp_(hWnd,"PB_WindowID") -1
works here for a normal window 8)

Posted: Fri Jul 06, 2007 6:23 pm
by Fluid Byte
Wtf? That's it? A simple window property? Jesus, there should really be some kind of documentation for all these internal PB tricks.

Posted: Fri Jul 06, 2007 6:49 pm
by Zizaco
hallodri wrote:For Window try this :

Code: Select all

debug GetProp_(hWnd,"PB_WindowID") -1
For Gadget :

Code: Select all

debug GetProp_(hWnd,"PB_ID")
;or 
debug GetDlgCtrlID_(hWnd)
WOrked! Thanks! :D