Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Minimize window

Posted on 1998-11-13
7
Medium Priority
?
589 Views
Last Modified: 2013-11-20
I will give 500 points to whoever can show me how to minimize a dialog box by clicking a button other than the minimize button.  I think it would have something to do with WM_MINIMIZE, but there is no such message.  What do I do?
0
Comment
Question by:oblong
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 

Author Comment

by:oblong
ID: 1324664
Edited text of question
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1324665
To minimize a window, you want to send it a message (which you knew).  However, there is no WM_MINIMIZE message.  These system messages are hidden as parameters for the WM_SYSCOMMAND message.  So, in order to minimize a window by clicking a button, put this code in the function that is called when the button is clicked:

  POINT pt;
  GetCursorPos (&pt);
  SendMessage (WM_SYSCOMMAND, SC_MINIMIZE, pt.y << 16 | pt.x);

If you have any further questions regarding this, please feel free to ask.  Thanks!
0
 
LVL 6

Accepted Solution

by:
thresher_shark earned 2000 total points
ID: 1324666
Please take my above comment as an "answer."
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 7

Expert Comment

by:psdavis
ID: 1324667
Additional notes...

You can make the lParam a little bit easier with the MAKELONG macro.

GetCursorPos (&pt);
SendMessage( WM_SYSCOMMAND, SC_MINIMIZE, MAKELONG( pt.x, pt.y ));

Thresh, is the GetCursorPos necessary?  Would SendMessage( WM_SYSCOMMAND, SC_MINIMIZE, 0 ) work ?  I haven't tried it, but was wondering why the cursor position was necessary...

Phillip
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1324668
Yes, that is a good question.  I always just stuck it in there to make sure it was happy.  From there, I would go to old source code and copy it into the new source code so I have always used that method. :-)  Code re-use I suppose.

I'll give it a shot right now...

<pause>

.Indeed it does work, so oblong, you can use this code instead:
SendMessage (WM_SYSCOMMAND, SC_MINIMIZE, 0);

Thanks Phillip!  I'll have to remember that for in the future.
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1324669
Huh, that's strange, before the word "Indeed" I put three periods: ... but they didn't show up!  Let's try that again:

.Indeed (3 periods)
..Indeed (4 periods)
...Indeed (5 periods)
0
 

Author Comment

by:oblong
ID: 1324670
Thanks.  You were a great help.
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question