how to make serv-u ftp a service / remove icon from tray?

syf3r

Senior member
Oct 15, 1999
673
0
0

does anyone know the procedure for removing servu-ftp's icon from the system tray, while at the same time making it a system service so it is always running in the background, but not icon is visible?

-syf3r.
 

DocDoo

Golden Member
Oct 15, 2000
1,188
0
0
If I tell you, does this mean you will give me "full-leech" access :)

Get it here!

If you know how to program, this will demonstrate how to make a tray application, with a tray icon and a popup menu, it also shows how to hide the Task Icon and the Application´s Main form.

Make note, I offer no support.
------(COPY PASTE BELOW)-------

unit unit1;

interface

uses Windows, Classes, Forms, Messages, Controls, ShellAPI, Menus, SysUtils;

type

TForm1 = class(TForm)
PopupMenu1: TPopupMenu;
MainMenu1: TMainMenu;
Showform1: TMenuItem;
ShowApplication1: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure WndProc(var Message: TMessage); override;
procedure Showform1Click(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
IconNotifyData : TNotifyIconData;
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

// Catch the Minimize event before the application
procedure TForm1.WndProc(var Message: TMessage);
var
p : TPoint;
begin
case Message.Msg of
WM_SYSCOMMAND:
case Message.WParam and $FFF0 of
SC_MINIMIZE: begin
// Hide the Mainform
Hide;
// Bail out here, so the Application dont starts to show the form
Exit;
end;
SC_RESTORE: ;
end;
WM_USER + 1:
case Message.lParam of
WM_RBUTTONDOWN: begin
GetCursorPos(p);
PopupMenu1.Popup(p.x, p.y);
end;
WM_LBUTTONDOWN: begin
Show;
end;
end;
end;
inherited ;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
//Now set up the IconNotifyData structure so that it receives
//the window messages sent to the application and displays
//the application's tips
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;

//Copy the Application's Title into the tip for the icon
StrPCopy(IconNotifyData.szTip Application.Title);

//Add the Icon to the system tray and use the
//the structure and its values
Shell_NotifyIcon(NIM_ADD, @IconNotifyData);

// Hide MainForm at startup.
//(Remove if application is to be shown at startup)
Application.ShowMainForm := False;

// Toolwindows dont have a TaskIcon.
//(Remove if TaskIcon is to be show when form is visible)
SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
end;


// Shows the form when user click on TrayIcon
procedure TForm1.Showform1Click(Sender: TObject);
begin
// Show the Mainform.
Show;
// Put the form in top of all others.
SetForegroundWindow(Self.handle);
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
Shell_NotifyIcon(NIM_DELETE, @IconNotifyData);
end;
 

Praetor

Diamond Member
Oct 14, 1999
4,498
4
81
Listed in the "Common Problems" area:

UPGRADING FROM A PREVIOUS BETA WITHOUT UNINSTALLING CAN RENDER YOUR SYSTEM UNBOOTABLE. Should this situation arise, recovery instructions are available on my Common Problems page.

Hahahaha.... no. I'd really hate to see what counts as an "unusual" problem. ;)

Too bad it doesn't work with Win2k.