Getting the window activation state with GetWindow

Everything else that doesn't fall into one of the other PB categories.
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 NIN.

I want to see if a window is the current/activated window. How do I do this? The code below always returns a '0'. What are all the variables in a windowplacement structure?

hwnd=OpenWindow(0,20,20,200,200,0,"WINDOW")
win.windowplacement
GetWindowPlacement_(hwnd,win)
s$=Str(win\flags)
MessageRequester("",s$,0)

Thanks.
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 NIN.

I should add that this should use the Windows API, not PB commands.

Thanks for any help you can provide.
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 El_Choni.

I this GetFocus_() and GetActiveWindow_() do this. If you get a NULL value, it means your app doesn't have any active window, otherwise you'll get the WindowID (handle).

El_Choni
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.

> I want to see if a window is the current/activated window.

To see if your own window has the focus:

If GetForegroundWindow_()=WindowID()...

To see if another window has the focus, and you have its handle:

If GetForegroundWindow_()=handle...
Post Reply