Solved

Make a windows shell program

Posted on 2003-11-09
8
224 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 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

11 Experts available now in Live!

Get 1:1 Help Now