Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Minimize the window  (Read 4009 times)

0 Members and 1 Guest are viewing this topic.

Nero

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Minimize the window
« on: June 20, 2018, 11:21:44 am »
Hello guys! I've created a custom titlebar that's fully working EXCEPT the minimize button. I can't minimize the window even if I try to do it from the windows taskbar. Any ideas? I would prefer one that's not Windows-specific but if there is no other solution, I'd be grateful to hear the windows one too! :D



Edit: Wow, that's a big image lol.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10191
    • View Profile
    • development blog
    • Email
Re: Minimize the window
« Reply #1 on: June 20, 2018, 11:38:09 am »
Programmatically minimizing and maximizing the window is not yet supported by SFML.

For Windows however it should be trivial to do, check the MSDN documentation.
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

Nero

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Minimize the window
« Reply #2 on: June 20, 2018, 11:52:56 am »
Well, thanks I guess. Are you guys planning to implement something like that btw? :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Minimize the window
« Reply #3 on: June 20, 2018, 11:59:39 am »
Laurent Gomila - SFML developer

Nero

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Minimize the window
« Reply #4 on: August 05, 2018, 03:50:28 pm »
Yes we do.

Does this work? I'm not really familiar with GitHub and I couldn't find a download link.

Drifty Pine

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: Minimize the window
« Reply #5 on: August 10, 2018, 09:55:50 pm »
No need to download anything if all you want to do is minimize on MS-Windows.
Just get the system handle and pass it to the MS-Windows ShowWindow() function:

::ShowWindow(window.getSystemHandle(), SW_MINIMIZE);

('window' in the above call is an sf::Window or sf::RenderWindow)

Make sure to include the MS-Windows header:
#include <windows.h>


FRex

  • Hero Member
  • *****
  • Posts: 1839
  • Not doing gamedev/using SFML lately
    • View Profile
    • Email
Re: Minimize the window
« Reply #6 on: August 11, 2018, 03:26:22 pm »
WinAPI is really useful and easy to use for a lot of stuff that came up on forums like dropping files, turning IME off, maximize and minimize, etc. but you should put that code in its own cpp file, not mix it into your own code.

Windows.h once broke rectangle shape for someone in a very non obvious way: https://en.sfml-dev.org/forums/index.php?topic=23503.msg160917

min and max macros don't get defined if you define NOMINMAX but it's cleaner anyway to put platform specific stuff in its own cpp file to later reimplement it or put empty definitions there on a different platform, not mix platform specific and portable code, etc.
I'm not using SFML nor doing any gamedev lately.