Link to home
Start Free TrialLog in
Avatar of boel
boel

asked on

Show program only at startbar as an icon

Hi.
How do I make my Borland C++ Builder program
(one Form) show up only at the same place where the
time is shown at Win95.
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of boel
boel

ASKER

Where do I put the code, in my Unit1.cpp
---------------------------------------------------
#include <vcl\vcl.h>
#pragma hdrstop

#include "Unit1.h"
#pragma resource "*.dfm"
TForm1 *Form1;
__fastcall TForm1::TForm1(TComponent* Owner)
      : TForm(Owner)
{
}
-------------------------------------------

or in my project1.cpp

WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
      try
      {
            Application->Initialize();
            Application->CreateForm(__classid(TForm1),&Form1);
            Application->Run();
      }
      catch (Exception &exception)
      {
            Application->ShowException(&exception);
      }
      return 0;
}-----------------------------
BOEL

Well, it depends on when you want to show up the icon - in a plain Win32 program, i'd add the icons immediatly after the call to 'CreateWindow()', just before entering the main message loop.
after Application->CreateForm() you put this one...

Application->ShowMainForm = false;

The function should be executed at OnCreate() of the form.....

Cheers,
Viktor
Avatar of boel

ASKER

Well, it nearly work, but I dont see any icon,
just an empty space where the icon should be.
How about the parameter to TaskBarAddIcon()
The first one "hwnd", which handle shall I pass to that one
 Application->Handle or Form->Handle?
The last one "lpszTip" is the text that show up when the mouse-
-pointer is over the icon I think.
But what about the second and third paramter
"uID", "hicon" ?  
And how shall I handle the callback messages that "jkr" told me in the proposed answer??
One more question, (that maybe not included in the start question), how do I do to make the Icon response to mouseclick??
Boel
You need to pass the Application->Handle.... and you need to assigne something to the icon, if you want to have an icon in the emprty space...

for example...

AddICon.... (..... , Application->Icon,.........);

to have the icon of the app in the task bar...

and remember that you need to remove the taken space by the your procedure....That procedure puts it in the task bar, but it needs to realese it in OnDestroy() of your application...

Cheers,
Viktor
You can also get help about taskbar in help file. Search Win32 SDK.
As far as I know, there is no MFC support like CTaskbar, you should use Win32 SDK to implement.