Solved

message to minimize a window in the task bar

Posted on 2000-02-17
5
527 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
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

808 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