Page 1 of 1

Check if a window is minimized

Posted: Tue Oct 09, 2001 11:12 pm
by BackupUser
Code updated for 5.20+ (same as GetWindowState())

Restored from previous forum. Originally posted by Franco.

Code: Select all

; (c) 2001 - Franco's template - absolutely freeware
; IsIconic checks if a window is minimized or not.
; So if to store the window size and position is needed
; you can prevent to save minimized values when you close 
; a minimized window.

Procedure _ScreenWidth ()
  ProcedureReturn GetSystemMetrics_(#SM_CXSCREEN)
EndProcedure

Procedure _ScreenHeight ()
  ProcedureReturn GetSystemMetrics_ (#SM_CYSCREEN)
EndProcedure

; draw a window and place it outside the desktop
If OpenWindow(0, _ScreenWidth (), _ScreenHeight (), 320, 240, "Test if Window is minimized or not", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget)
  xPos = (_ScreenWidth () / 2) - (WindowWidth(0) / 2)
  yPos = (_ScreenHeight () / 2) - (WindowHeight(0) / 2)
  ; move the window to the center of the desktop
  ResizeWindow(0, xPos, yPos, #PB_Ignore, #PB_Ignore)
  Repeat
    EventID = WaitWindowEvent()
    If EventID = #PB_Event_CloseWindow
      Quit = 1
    EndIf
  Until Quit = 1
  
  If IsIconic_(WindowID(0))
    MessageRequester("Information","Window is minimized")
    ShowWindow_(WindowID(0),1)
    ;now it's a good time to save the window size and position if needed
  Else
    MessageRequester("Information","Window is not minimized")
  EndIf    
EndIf
End
Have a nice day...
Franco

Posted: Tue Oct 16, 2001 12:13 pm
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.
; (c) 2001 - Franco's template - absolutely freeware
; IsIconic checks if a window is minimized or not.
; So if to store the window size and position is needed
; you can prevent to save minimized values when you close
; a minimized window.

Have a nice day...
Franco
Franco, Just a query for those of us still learning PB...can your functions be converted to callable libraries? Can you bundle up your temples for us relative beginners and add them to the PB resource site?

Cutting and pasting from Internet Explorer does some strange things to the PB IDE so it might be easier this way.

Regards, Fangles

Fangles

Posted: Tue Oct 16, 2001 4:16 pm
by BackupUser
Restored from previous forum. Originally posted by Franco.

Oh Fangles, this would be great...
but I'm not a asm or C coder.
The only thing I can do now is, to write Procedures so you can call these and benefit from them.
I hope that, some fine day, PureBasic is able to create lib's itself. (Please Fred )
OK, a library created with PB can't be as good as a good asm coder would make it, but it's better (IMHO) than Procedures in Include files (...I like Includes files).

I began to organize some PB code on my HD and, you have right, it is a good idea to bundle it up and to put it on Pauls Server.
I will do that, stay tuned...




Have a nice day...
Franco


Edited by - franco on 16 October 2001 17:17:46

Posted: Wed Oct 17, 2001 7:25 am
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.

I began to organize some PB code on my HD and, you have right, it is a good idea to bundle it up and to put it on Pauls Server.
I will do that, stay tuned...
You and Mr Skunk make some great stuff and it's been of help to me, that's why I wanted to see it on the resource site. Thanks. If I ever get this IncrediMail cataloguer working, I can post that as well.

Fangles