Solved

message to minimize a window in the task bar

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

758 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

21 Experts available now in Live!

Get 1:1 Help Now