What is PB constant for Window Minimize?[SOLVED]

Just starting out? Need help? Post your questions and find answers here.
SkyManager
Enthusiast
Enthusiast
Posts: 339
Joined: Tue Jan 30, 2007 5:47 am
Location: Hong Kong

What is PB constant for Window Minimize?[SOLVED]

Post by SkyManager »

We can detect the window closing with PB constant #PB_Event_CloseWindow.

If I want to detect the window is minimizing by the user, what will be the PB constant? #PB_Event_MinimizeWindow?
Last edited by SkyManager on Sun Mar 11, 2007 3:54 am, edited 1 time in total.
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

Check the wParam of #WM_SIZE wich can be:

SIZE_MAXHIDE
Message is sent to all pop-up windows when some other window is maximized.
SIZE_MAXIMIZED
The window has been maximized.
SIZE_MAXSHOW
Message is sent to all pop-up windows when some other window has been restored to its former size.
SIZE_MINIMIZED
The window has been minimized.
SIZE_RESTORED
The window has been resized, but neither the SIZE_MINIMIZED nor SIZE_MAXIMIZED value applies.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

minimizing seems to be a #PB_Event_MoveWindow.

check it out:

Code: Select all

If OpenWindow(0, 0, 0, 500, 400, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget ) 
   Repeat 
      Event = WaitWindowEvent() 
      Debug event 
   Until  Event = #PB_Event_CloseWindow 
EndIf 
to determine if it is a move or a minimize you may have to check the messages like Fluid said...
oh... and have a nice day.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Code: Select all

#APPNAME = ""
#WndMain = 0

OpenWindow(#WndMain, 0, 0, 640, 480, #APPNAME, #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
CreateGadgetList(WindowID(#WndMain))

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_DeactivateWindow
      If GetWindowState(#WndMain) = #PB_Window_Minimize
        Debug "Minimized"
      EndIf
    Case #PB_Event_CloseWindow
      Break
  EndSelect
ForEver
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

#PB_Event_MoveWindow works, too:

Code: Select all

OpenWindow(0, 0, 0, 500, 400, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget ) 
OldState = GetWindowState(0)

Repeat 
  Event = WaitWindowEvent() 
  Select Event 
    Case #PB_Event_MoveWindow
      State = GetWindowState(0)
      If State <> OldState
        OldState = State
        Select State
          Case #PB_Window_Minimize
            Debug "just minimized"
          Case #PB_Window_Maximize
            Debug "just maximized"
          Case #PB_Window_Normal
            Debug "original size"
        EndSelect
      EndIf
  EndSelect
Until  Event = #PB_Event_CloseWindow 
oh... and have a nice day.
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

We have GetWindowState() ?

Oh boy... :roll:
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

#PB_Event_MoveWindow works, too:
not on linux
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

saw your topic... did you test it with my code, too?
oh... and have a nice day.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

the code by trond works only on linux (the constant is'nt available in windows) ,
and the code by kaeru works only in windows :wink:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

ts-soft wrote:and the code by kaeru works only in windows :wink:
No, it should be crossplatform compatible. Everything used is available on both systems.

But the question is if this is required at all.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

>> it should
but is it :wink:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
SkyManager
Enthusiast
Enthusiast
Posts: 339
Joined: Tue Jan 30, 2007 5:47 am
Location: Hong Kong

Post by SkyManager »

Running in my PB4.02/Win2000,
#PB_Event_DeactivateWindow is not found :!:

[ ADDED ]
Yes, Kaeru Gaman's code is working :P

Thanks
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Kaeru Gaman wrote:saw your topic... did you test it with my code, too?
Yes
the code by trond works only on linux (the constant is'nt available in windows) ,
Oups.
SkyManager
Enthusiast
Enthusiast
Posts: 339
Joined: Tue Jan 30, 2007 5:47 am
Location: Hong Kong

Post by SkyManager »

Finally, I find a very brief/straight-forward answer

Code: Select all

 if IsIconic_(WindowID(MainWindow))
. . . .
endif
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

SkyManager wrote:Finally, I find a very brief/straight-forward answer

Code: Select all

 if IsIconic_(WindowID(MainWindow))
. . . .
endif
:lol: well.. since this is WinAPI it's windows pure and no PB-solution.
oh... and have a nice day.
Post Reply