Solved

Make a windows shell program

Posted on 2003-11-09
8
226 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
delphi exception 7 64
delphi parse string to params 3 123
DBCtrlGrid, Delphi, Scroll 7 15
Firemonkey BASS_Init into a thread 17 9
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
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…

809 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