Solved

Make a windows shell program

Posted on 2003-11-09
8
227 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

790 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