Solved

message to minimize a window in the task bar

Posted on 2000-02-17
5
532 Views
Last Modified: 2012-05-04
Hello!

I have a little problem with a application.

I have coded a function which can hide the window in the task bar and show instead his icon.
But this fonction reacts when I receive the message TWMSysCommand::SC_MINIMIZE.

I want to hide my application when it creates and not when I minimize it.

Can you help me in giving me the right message to catch or the right thing to do?

thanks!
0
Comment
Question by:ryuken
[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
  • 3
5 Comments
 
LVL 5

Accepted Solution

by:
jamoville earned 50 total points
ID: 2531779
In the InitInstance of the application you can tell the application to start up minimized.  This is a piece of code I used to start my application hidden.  You would change SW_HIDE to SW_MINIMIZE.

/* Create the main window, this code creates a new frame window object and then sets it as the application's main window object.*/
      
CMainFrame* pFrame = new CMainFrame();
if (pFrame == NULL)
{
  return FALSE;
}

// Set our thread's main window object.
m_pMainWnd = pFrame;

/* The one and only window has been initialized, so show and update it.
We don't want the window to be visible to the user, thus, we hide it.*/

m_pMainWnd->ShowWindow(SW_HIDE);  m_pMainWnd->UpdateWindow();
0
 
LVL 11

Expert Comment

by:alexo
ID: 2531807
If you don't ::ShowWindow() after creation, it will never draw.
Alternatively, try ::ShowWindow(hWnd, SW_HIDE);

This is obviously not a C++ question.  Better try the OWL area.
0
 

Author Comment

by:ryuken
ID: 2541540
Hello Jamoville!

I can't try the solutions that you give me. Because I'm using Borland C++ builder 4 and I can't create myself the main Window.

I can hide the main window if I put a timer which calls a function after this window has been shown.

But it is not perfect.

I have called this function when I have these events: OnCreate, OnShow, OnActivate. But It didn't work.

If you have any others idears, I thanks you.

0
 
LVL 5

Expert Comment

by:jamoville
ID: 2543030
Sorry - I'm not sure with Borland C++.  I would reject my answer and let others respond.  There has got to be someone out there with the answer.
0
 
LVL 5

Expert Comment

by:jamoville
ID: 2543819
Sorry - I'm not sure with Borland C++.  I would reject my answer and let others respond.  There has got to be someone out there with the answer.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

626 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