show window minimized maximized without focus taken

This is a discussion on show window minimized maximized without focus taken within the Windows Programming forums, part of the Platform Specific Boards category; hey, i searched everywhere, i want to use ShowWindow(SW_SHOWMINNOACTIVE) but i want the window to be maximized and using something ...

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    103

    show window minimized maximized without focus taken

    hey, i searched everywhere, i want to use ShowWindow(SW_SHOWMINNOACTIVE) but i want the window to be maximized and using something like this:

    ShowWindow(SW_SHOWMINNOACTIVE);
    ShowWindow(SW_MAXIMIZE);

    or:

    ShowWindow(SW_MAXIMIZE);
    ShowWindow(SW_SHOWMINNOACTIVE);

    just doesn't work, i want to show the window maximized and minimized without any focus taken and i also don't want to see a maximized window going minimized as fast as possible, i want it to be maximized before really showing the window minimized.

    im looking for something like SW_SHOWMINMAXNOACTIVE but there is no such thing i guess..

    any ideas?

    thanks

  2. #2
    Registered User khdani's Avatar
    Join Date
    Oct 2007
    Posts
    42
    Doesn't ShowWindow supposed to receive two arguments ?!
    ShowWindow(handle,param) where handle is the handle to the window which you want to minimize.

  3. #3
    Registered User
    Join Date
    Dec 2004
    Posts
    103
    thats correct, but im using MFC and that code inside a CDialog class so i dont need to specify the handle :P


    please isn't there a way to do this?

    i think M$ didn't think about this one..

  4. #4
    Registered User khdani's Avatar
    Join Date
    Oct 2007
    Posts
    42
    i don't know much about MFC, i've used Win32 API only...
    you can get a handle to your window and then use the regular ShowWindow function
    or you can send a maximize/minimize message to your window, or the best choice I think would be
    to hide your window (so it won't be visible at all) maximize/minimize it and then show it again.

  5. #5
    Registered User
    Join Date
    Dec 2004
    Posts
    103
    Quote Originally Posted by khdani View Post
    i don't know much about MFC, i've used Win32 API only...
    you can get a handle to your window and then use the regular ShowWindow function
    or you can send a maximize/minimize message to your window, or the best choice I think would be
    to hide your window (so it won't be visible at all) maximize/minimize it and then show it again.
    how could i send a maximize message to my window without using the ShowWindow() function which actually shows the window if i use the SW_MAXIMIZE parameter..?


  6. #6
    Banned
    Join Date
    Dec 2008
    Posts
    49
    Here is one I found whilst looking for an MFC usage of SetWindowPos().

  7. #7
    Registered User
    Join Date
    Dec 2004
    Posts
    103
    Quote Originally Posted by MattW View Post
    Here is one I found whilst looking for an MFC usage of SetWindowPos().
    hmm but i don't see any maximize parameter there, or am i missing something? sorry if i am..

  8. #8
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,854
    Quote Originally Posted by eXistenZ View Post
    hey, i searched everywhere, i want to use ShowWindow(SW_SHOWMINNOACTIVE) but i want the window to be maximized and using something like this:

    ShowWindow(SW_SHOWMINNOACTIVE);
    ShowWindow(SW_MAXIMIZE);

    or:

    ShowWindow(SW_MAXIMIZE);
    ShowWindow(SW_SHOWMINNOACTIVE);

    just doesn't work, i want to show the window maximized and minimized without any focus taken and i also don't want to see a maximized window going minimized as fast as possible, i want it to be maximized before really showing the window minimized.

    im looking for something like SW_SHOWMINMAXNOACTIVE but there is no such thing i guess..

    any ideas?

    thanks
    Could you put this another way?

    Sounds like you want the window to be minimised (or an icon) and maximised at the same time (which is impossible).

    Why not just make it invisible with SW_HIDE?

    Or disable the window with EnableWindow(FALSE)?
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  9. #9
    Registered User
    Join Date
    Dec 2004
    Posts
    103
    Quote Originally Posted by novacain View Post
    Could you put this another way?

    Sounds like you want the window to be minimised (or an icon) and maximised at the same time (which is impossible).

    Why not just make it invisible with SW_HIDE?

    Or disable the window with EnableWindow(FALSE)?
    imagine you receive a message from somebody and for that i show a window with the current message minimized, flashed and without any focus taken, if that window was maximized before it was closed it should display the window now maximized but also minimized, flashed and without any focus taken.. thing is you can have a window maximized (manually) and then minimized to the taskbar but seems like microsoft never thought of this possibility to show it maximized and minimized..

    what were you talking about making it invisible or disabling? i don't think it will help.. thanks anyway

    if there is a way though please tell me..

  10. #10
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,854
    Sorry but I do not understand.

    Try to put one thought/requirement per sentance.



    Quote Originally Posted by eXistenZ View Post
    imagine you receive a message from somebody and for that i show a window
    So an incomming msg is processed, displayed and brings the required window to the front of the z-order and make it visible. (SetWindowPos and ShowWindow)

    Quote Originally Posted by eXistenZ View Post
    with the current message minimized, flashed and without any focus taken,
    Is the 'current message' the one I was reading (and had focus) or the one that just arrived?

    Quote Originally Posted by eXistenZ View Post
    if that window was maximized before it was closed it should display the window now maximized but also minimized, flashed and without any focus taken..
    A window, by definition, can not be both 'maximized but also minimized'.
    Flashed, what do you mean?

    Quote Originally Posted by eXistenZ View Post
    thing is you can have a window maximized (manually) and then minimized to the taskbar but seems like microsoft never thought of this possibility to show it maximized and minimized..
    MS did not think of it because maximised and minimised are mutually exclusive....

    Quote Originally Posted by eXistenZ View Post
    what were you talking about making it invisible or disabling? i don't think it will help.. thanks anyway
    Disabled windows do not get focus.

    App windows with the WS_VISIBLE style removed (using ShowWindow(SW_HIDE)) show in the task bar (as if minimised) but are invisible on the screen (and do not move or resize). This means you can just call ShowWindow(SW_SHOW) to bring them back to the same position and size.

    As far as I can tell this is what you want.

    Quote Originally Posted by eXistenZ View Post
    if there is a way though please tell me..
    I did, you discarded it without any research or testing.....
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  11. #11
    Registered User
    Join Date
    Dec 2004
    Posts
    103
    Quote Originally Posted by novacain View Post
    Sorry but I do not understand.

    Try to put one thought/requirement per sentance.





    So an incomming msg is processed, displayed and brings the required window to the front of the z-order and make it visible. (SetWindowPos and ShowWindow)



    Is the 'current message' the one I was reading (and had focus) or the one that just arrived?



    A window, by definition, can not be both 'maximized but also minimized'.
    Flashed, what do you mean?



    MS did not think of it because maximised and minimised are mutually exclusive....



    Disabled windows do not get focus.

    App windows with the WS_VISIBLE style removed (using ShowWindow(SW_HIDE)) show in the task bar (as if minimised) but are invisible on the screen (and do not move or resize). This means you can just call ShowWindow(SW_SHOW) to bring them back to the same position and size.

    As far as I can tell this is what you want.



    I did, you discarded it without any research or testing.....
    ah lemme try to explain it again, you know MSN Messenger right? when you receive a message there it shows a window minimized to the taskbar and flashed (FlashWindow()) if that window was not already open, lets say i open (double click on a contact) a window there and maximize it then close, if i open the window again it displays it maximized now, but if i receive a message with it closed it shows it unmaximized (normal :P) minimized to the taskbar, flashed, without any focus taken, but if i maximize that window now and minimize it myself to the taskbar and not close it and receive a message again it will be minimized, maximized, flashed, without any focus taken from other windows, im just trying to show it like that considering it was already closed.. understand now? :P by maximized i don't mean restored showed to the screen, i mean when you click the minimized window from the taskbar it will display as maximized to the screen and not normal.. if you still did not understand we can do a test on my chat program if you want :P

    by the way when i close my window i DestroyWindow() it, and not hide it, so i need to create it again when i receive a message and the window is not created..

    thanks

    edit: i guess im looking for a way to make the window maximized without showing it on the screen..

    something like this:
    Code:
    	m_dlg.Create(IDD_TEST_DIALOG, GetDesktopWindow());
    	m_dlg.ShowWindow(SW_MAXIMIZE);
    	m_dlg.ShowWindow(SW_HIDE);
    	m_dlg.ShowWindow(SW_SHOWMINNOACTIVE);
    where m_dlg is a CDialog
    but the problem is i can see it going maximized first and then disappearing which is annoying.. if there is another way to set a window maximized without showing it please tell me..
    Last edited by eXistenZ; 12-12-2008 at 08:38 AM.

  12. #12
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,854
    Quote Originally Posted by eXistenZ View Post
    but the problem is i can see it going maximized first and then disappearing which is annoying.. if there is another way to set a window maximized without showing it please tell me..
    OK It appears briefly on screen and then disappears?

    For dialogs;
    Add a OnInitDialog() handler and call ShowWindow(SW_HIDE)

    or

    remove the WM_VISIBLE style by setting 'Visible' to false in the 'Properties' in the resource editor.

    or

    modify the styles at run time in the CreateWindow() call (remove WM_VISIBLE)

    Windows;
    Add a OnCreate() handler and call ShowWindow(SW_HIDE)

    or

    modify the styles at run time in the CreateWindow() call (remove WM_VISIBLE)
    Last edited by novacain; 12-12-2008 at 11:11 PM.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  13. #13
    Registered User
    Join Date
    Dec 2004
    Posts
    103
    Quote Originally Posted by novacain View Post
    OK It appears briefly on screen and then disappears?
    yes, that will always happen when using ShowWindow(SW_MAXIMIZE);


    i already tried removing WS_VISIBLE style, it just doesn't help, ShowWindow(SW_MAXIMIZE); shows the window no matter what and disappears very fast then (using the code i posted above).. thats why i need an alternative to mark the window as maximized i guess.. i don't know..

    thanks
    Last edited by eXistenZ; 12-13-2008 at 03:18 AM.

  14. #14
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,854
    Don't use SW_MAXIMISE when starting, use it when you get a msg.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  15. #15
    Registered User
    Join Date
    Dec 2004
    Posts
    103
    Quote Originally Posted by novacain View Post
    Don't use SW_MAXIMISE when starting, use it when you get a msg.
    well that is when i create the window.. when i receive a message..

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM
  2. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 09:01 PM
  3. Winamp Vis if anyone can help
    By Unregistered in forum Windows Programming
    Replies: 6
    Last Post: 01-26-2002, 11:43 PM
  4. run a program
    By goodmonkie in forum Windows Programming
    Replies: 2
    Last Post: 10-07-2001, 11:19 AM
  5. Invoking MSWord
    By Donn in forum C Programming
    Replies: 21
    Last Post: 09-08-2001, 04:08 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21