?
Solved

Make a windows shell program

Posted on 2003-11-09
8
Medium Priority
?
231 Views
Last Modified: 2010-04-05
I want to make a shell program to replace windows explorer,  But , I don't know how to make tray taskbar,  That's mean the tray icon will send which message to me and how I respond this message.   Would u please give me some code. Thanks
0
Comment
Question by:cookey
[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
8 Comments
 

Accepted Solution

by:
BrunoMS earned 172 total points
ID: 9714363
You need to hook SysTray.dll functions. Thats all that i know =P
Use MadCollection for this!
0
 
LVL 5

Assisted Solution

by:DeerBear
DeerBear earned 164 total points
ID: 9715328
Hi,

The first step, imho, is to go MSDNing and read there all you have to know to start with it.
A basic shell system wouldn't bee too complicated and - keeping in mind that someone did one with VB -
shouldn't bee too complicated to do with Delphi.

Secondly, a better working shell will be *lots* more complicated to write, but I am confident that you
can handle it once you understand its inner workings.

Thirdly, the taskbar communicates with you through messages.
You have to know which messages are sent/received and act accordingly.

Please bear in mind that most Windows Shell parts are, in fact, IE windows, like for example
Windows Desktop that we see, that's an IE window.

Thus I would do a very deep investigation on the window classes used and try to get them
working on my own, if I was you.

Further information can be found on MSDN.

HTH,

Andrew
0
 
LVL 5

Assisted Solution

by:Hypoviax
Hypoviax earned 164 total points
ID: 9743578
If you want to show an icon in the task pane this code works great:

uses ..., ShellApi;

type
  TForm1 = class(TForm)
    PopupMenu1: TPopupMenu; // popup menu for the tray with two options: show and exit
    mnuTrayShow: TMenuItem;
    mnuTrayExit: TMenuItem;
     procedure ToTray;
     procedure FormCreate(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure mnuTrayShowClick(Sender: TObject);
    procedure mnuTrayExitClick(Sender: TObject);
  private
    { Private declarations }
  protected
    procedure WndProc(var Msg : TMessage); override;
  public
    { Public declarations }
    IconNotifyData : TNotifyIconData;
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

uses unit2, Tools;

procedure TForm1.ToTray;
begin
  Form1.Hide;
end;

procedure TForm1.WndProc(var Msg : TMessage);
var
   p : TPoint;
begin
  case Msg.Msg of
    WM_USER+1:
    case Msg.lParam of
      WM_RBUTTONUP: begin // show popup menu with two options: show and exit
        GetCursorPos(p);
        PopupMenu1.Popup(p.x, p.y);
      end;
      WM_LBUTTONUP: begin
         mnuTrayShowClick(Self);
      end;
    end;
  end;
  if (Msg.Msg = WM_SYSCOMMAND) and (Msg.wParam = SC_MINIMIZE) then begin
    ToTray;
    Msg.wParam := 0;
    Msg.lParam :=0;
  end;
  inherited;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  with IconNotifyData do begin
    hIcon :=Application.Icon.Handle;
    uCallbackMessage := WM_USER + 1;
    cbSize := sizeof(IconNotifyData);
    Wnd := Handle;
    uID := 100;
    uFlags := NIF_MESSAGE + NIF_ICON + NIF_TIP;
  end;
  StrPCopy(IconNotifyData.szTip, 'CD FTP');
  Shell_NotifyIcon(NIM_ADD, @IconNotifyData);
end;

procedure TForm1.FormActivate(Sender: TObject);
begin
  ShowWindow(Application.Handle, SW_HIDE);
  SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Shell_NotifyIcon(NIM_DELETE, @IconNotifyData);
  Application.ProcessMessages;
end;

procedure TForm1.mnuTrayShowClick(Sender: TObject);
begin
  Form1.Show;
  Application.BringToFront;
end;

procedure TForm1.mnuTrayExitClick(Sender: TObject);
begin
  Close;
end;

end.

As to the other stuff you mentioned i don't know what you are refering to.

Regards,

Hypoviax
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:cookey
ID: 9752827
hi, DeerBear, I try to find in MSDN, But ,I can't find any function about make my systemtray and make own shell,  :_(
0
 
LVL 5

Expert Comment

by:DeerBear
ID: 9769454
Hi,

To give you an idea of the necessary work, have a look at this:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics.asp

There're also other sections you have to look at, on the left pane.

HTH.

Andrew
0
 

Author Comment

by:cookey
ID: 9856659
although I haven't find out the content which I interesting, but thanks the same
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

718 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