Solved

Make a windows shell program

Posted on 2003-11-09
8
225 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
8 Comments
 

Accepted Solution

by:
BrunoMS earned 43 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 41 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 41 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
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.

 

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

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

Suggested Solutions

Title # Comments Views Activity
Using idhttp to login to instagram 2 76
Delphi application Soap connection 5 96
Delphi selector screen 2 69
Convert a string into a TDateTime 5 50
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

920 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

17 Experts available now in Live!

Get 1:1 Help Now