当前位置:主页>销售管理软件> 列表

帮帮忙,在线立等

进销存管理软件版1楼: SetWindowLong(Application.Handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW);
SetWindowLong的用法:托盘程序,如何让窗口既不在任务栏显示,又不在桌面显示。

2楼: showwindow(form1.handle,sw_hide); 如易友进销存软件

3楼: 来自:gooodlife, 时间:2005-9-11 15:21:02, ID:3201010
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, ShellAPI;
// 自已加入 ShellAPI

// 自定义 TrayICON 的消息
Const
WM_BARICON=WM_USER+200;


type
TForm1 = class(TForm)
PopupMenu1: TPopupMenu;
N1: TMenuItem; // 退出
N2: TMenuItem; // 打开/隐藏
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
R_lpData : PNotifyIconData; // 2004-06-03 用于托盘
procedure WMSysCommand(var Message: TMessage); message WM_SYSCOMMAND;


procedure WMBarIcon(var Message:TMessage); message WM_BARICON;
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.N1Click(Sender: TObject);
begin // 退出
Application.Terminate ;
end;

procedure TForm1.N2Click(Sender: TObject);
begin // 打开/隐藏
Form1.Visible := Not(Form1.Visible) ;
end;

procedure TForm1.WMBarIcon(var Message: TMessage);
var
pos : TPoint;
Begin
Case Message.LParam Of
WM_LBUTTONDBLCLK:
begin
//如果用户双击击任务栏图标则将图标删除并回复窗口。
Form1.Visible := True;
end;
WM_RBUTTONDOWN: //用户单击右键,则弹出菜单
begin
GetCursorPos(pos);
PopupMenu1.Popup(pos.x,pos.y);
end;
end; // end case Message.LParam of
end;

procedure TForm1.WMSysCommand(var Message: TMessage);
begin
if Message.WParam = SC_ICON then
begin
Form1.Visible := False;
end
else
if Message.WParam = SC_CLOSE then
begin
Form1.Visible := False;
end
else
begin
DefWindowProc(Form1.Handle, Message.Msg, Message.WParam, Message.LParam);
end;
end;

procedure TForm1.FormShow(Sender: TObject);
begin
// 开始托盘

Self.Icon.Handle := Application.Icon.Handle;

R_lpData := New(PNotifyIconDataA);
R_lpData.cbSize := SizeOf(PNotifyIconDataA) ; // 88;
R_lpData.Wnd := Form1.Handle;
R_lpData.hIcon := Form1.Icon.Handle ;
R_lpData.uCallbackMessage := WM_BARICON;
R_lpData.uID := 0;
R_lpData.szTip := ''QSecurity'';
R_lpData.uFlags := NIF_ICON or NIF_MESSAGE or NIF_TIP;

Shell_NotifyIcon(NIM_ADD,R_lpData);

// 结束托盘
//---------------------------------------------------------
end;

end.

4楼: with Application do
SetWindowLong(Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW or GetWindowLong(Handle,
GWL_EXSTYLE));
with MyNotifyStruct do begin


cbSize := sizeof(MyNotifyStruct);
Wnd := Handle;
uID := 1;
uFlags := NIF_ICON or NIF_TIP or NIF_MESSAGE;
uCallbackMessage := MI_ICONEVENT;
hIcon := Application.Icon.Handle;
szTip := ''系统托盘程序'';
end;
Shell_NotifyIcon(NIM_ADD, @MyNotifyStruct);
ShowWindow(Application.Handle,SW_HIDE);
// fmain.Visible :=false
SetWindowLong(Application.Handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW);
我的意思是:执行后在桌面上还有一个最小化了的窗口,如何消除?

5楼: 上面的程序最小化后在桌面上没有窗口了。

6楼: 还有窗口

进销存管理软件版7楼: 你新建个项目试试!!!