Solved

message to minimize a window in the task bar

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

932 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now