1:不看原来的贴子!
const
CCH_MAXNAME=255;
LNK_RUN_MIN=7;
LNK_RUN_MAX=3;
LNK_RUN_NORMAL=1;type LINK_FILE_INFO=record
FileName:array[0..MAX_PATH] of char;
WorkDirectory:array[0..MAX_PATH] of char;
IconLocation:array[0..MAX_PATH] of char;
IconIndex:integer;
Arguments:array[0..MAX_PATH] of char;
Description:array[0..CCH_MAXNAME] of char;
ItemIDList:PItemIDList;
RelativePath:array[0..255] of char;
ShowState:integer;
HotKey:word;
end;
function LinkFileInfo(const lnkFileName:string;var info:LINK_FILE_INFO;const bSet:boolean):boolean;
var
hr:hresult;
psl:IShelllink;
wfd:win32_find_data;
ppf:IPersistFile;
lpw:pwidechar;
buf:pwidechar;
begin
result:=false;
getmem(buf,MAX_PATH);
try
if SUCCEEDED(CoInitialize(nil)) then
if (succeeded(cocreateinstance(clsid_shelllink,nil,clsctx_inproc_server,IID_IShellLinkA,psl))) then
begin
hr:=psl.QueryInterface(iPersistFile,ppf);
if succeeded(hr) then
begin
lpw:=stringtowidechar(lnkfilename,buf,MAX_PATH);
hr := ppf.Load(lpw, STGM_READ);
if succeeded(hr) then
begin
hr := psl.Resolve(0, SLR_NO_UI);
if succeeded(hr) then
begin
if bSet then
begin
psl.SetArguments(info.Arguments);
psl.SetDescription(info.Description);
psl.SetHotkey(info.HotKey);
psl.SetIconLocation(info.IconLocation,info.IconIndex);
psl.SetIDList(info.ItemIDList);
psl.SetPath(info.FileName);
psl.SetShowCmd(info.ShowState);
psl.SetRelativePath(info.RelativePath,0);
psl.SetWorkingDirectory(info.WorkDirectory);
if succeeded(psl.Resolve(0,SLR_UPDATE)) then
result:=true;
end
else
begin
psl.GetPath(info.FileName,MAX_PATH, wfd,SLGP_SHORTPATH );
psl.GetIconLocation(info.IconLocation,MAX_PATH,info.IconIndex);
psl.GetWorkingDirectory(info.WorkDirectory,MAX_PATH);
psl.GetDescription(info.Description,CCH_MAXNAME);
psl.GetArguments(info.Arguments,MAX_PATH);
psl.GetHotkey(info.HotKey);
psl.GetIDList(info.ItemIDList);
psl.GetShowCmd(info.ShowState);
result:=true;
end;
end;
end;
end;
end;
finally
freemem(buf);
end;
end;
//*******************调用*****************
showmessage('FileName:'+info.filename+#13+'Description:'+info.Description+#13+'IconFilename:'+info.IconLocation+','+inttostr(info.IconIndex)+
#13+'WordDir:'+info.WorkDirectory+#13+'Arguments:'+info.Arguments+#13+'ShorCuts:'+shortcuttotext(s));
info.WorkDirectory:='D:\Borland\Delphi5\projects';
linkfileinfo(opendialog1.filename,info,true);
end;
end;
2:屏蔽开始按钮[EnableWindow() API],画一个自己的按钮放置到那个地方,就可以了。至于菜单的弹出还要说吗?Cake。
3:可以在IE控制面板中限制下载!但是不能阻止NetAnts之类的下载软件进行下载。如果要真正实现Internet下载监视,必须监视TCP/IP数据包!这个很难。
4:获得很容易,使用资源的方法就可以,ExtractIcon之类的函数,可以提取。修改的话,正在研究,不知道怎么搞的。
const
CCH_MAXNAME=255;
LNK_RUN_MIN=7;
LNK_RUN_MAX=3;
LNK_RUN_NORMAL=1;type LINK_FILE_INFO=record
FileName:array[0..MAX_PATH] of char;
WorkDirectory:array[0..MAX_PATH] of char;
IconLocation:array[0..MAX_PATH] of char;
IconIndex:integer;
Arguments:array[0..MAX_PATH] of char;
Description:array[0..CCH_MAXNAME] of char;
ItemIDList:PItemIDList;
RelativePath:array[0..255] of char;
ShowState:integer;
HotKey:word;
end;
function LinkFileInfo(const lnkFileName:string;var info:LINK_FILE_INFO;const bSet:boolean):boolean;
var
hr:hresult;
psl:IShelllink;
wfd:win32_find_data;
ppf:IPersistFile;
lpw:pwidechar;
buf:pwidechar;
begin
result:=false;
getmem(buf,MAX_PATH);
try
if SUCCEEDED(CoInitialize(nil)) then
if (succeeded(cocreateinstance(clsid_shelllink,nil,clsctx_inproc_server,IID_IShellLinkA,psl))) then
begin
hr:=psl.QueryInterface(iPersistFile,ppf);
if succeeded(hr) then
begin
lpw:=stringtowidechar(lnkfilename,buf,MAX_PATH);
hr := ppf.Load(lpw, STGM_READ);
if succeeded(hr) then
begin
hr := psl.Resolve(0, SLR_NO_UI);
if succeeded(hr) then
begin
if bSet then
begin
psl.SetArguments(info.Arguments);
psl.SetDescription(info.Description);
psl.SetHotkey(info.HotKey);
psl.SetIconLocation(info.IconLocation,info.IconIndex);
psl.SetIDList(info.ItemIDList);
psl.SetPath(info.FileName);
psl.SetShowCmd(info.ShowState);
psl.SetRelativePath(info.RelativePath,0);
psl.SetWorkingDirectory(info.WorkDirectory);
if succeeded(psl.Resolve(0,SLR_UPDATE)) then
result:=true;
end
else
begin
psl.GetPath(info.FileName,MAX_PATH, wfd,SLGP_SHORTPATH );
psl.GetIconLocation(info.IconLocation,MAX_PATH,info.IconIndex);
psl.GetWorkingDirectory(info.WorkDirectory,MAX_PATH);
psl.GetDescription(info.Description,CCH_MAXNAME);
psl.GetArguments(info.Arguments,MAX_PATH);
psl.GetHotkey(info.HotKey);
psl.GetIDList(info.ItemIDList);
psl.GetShowCmd(info.ShowState);
result:=true;
end;
end;
end;
end;
end;
finally
freemem(buf);
end;
end;
//*******************调用*****************
showmessage('FileName:'+info.filename+#13+'Description:'+info.Description+#13+'IconFilename:'+info.IconLocation+','+inttostr(info.IconIndex)+
#13+'WordDir:'+info.WorkDirectory+#13+'Arguments:'+info.Arguments+#13+'ShorCuts:'+shortcuttotext(s));
info.WorkDirectory:='D:\Borland\Delphi5\projects';
linkfileinfo(opendialog1.filename,info,true);
end;
end;
2:屏蔽开始按钮[EnableWindow() API],画一个自己的按钮放置到那个地方,就可以了。至于菜单的弹出还要说吗?Cake。
3:可以在IE控制面板中限制下载!但是不能阻止NetAnts之类的下载软件进行下载。如果要真正实现Internet下载监视,必须监视TCP/IP数据包!这个很难。
4:获得很容易,使用资源的方法就可以,ExtractIcon之类的函数,可以提取。修改的话,正在研究,不知道怎么搞的。
第3个问题,怎样限制网页另存选项以保护系统。(用程序如何实现?) 多谢Kingron!!!
第3个问题,怎样限制网页另存选项以保护系统。(用程序如何实现?) 多谢Kingron!!!
var
i,j,k:word;
icon,h:HICON;
t:TIcon;
begin
if ImageFlag = 0 then
begin
ImageList1.Clear;
ListView1.Items.Clear;
filenameList.Clear;
end;
filename := name;
i := ExtractIconEx(PChar(filename),-1,h,h,0);
while Pos('\',name)<> 0 do
begin
name := Copy(name,Pos('\',name)+1,Length(name));
end;
t := TICON.Create;
j:=0;
if i = 0 then
begin
icon:= ExtractAssociatedIcon(HInstance,PChar(filename),j);
filenameList.Add(name+#13#10+'#'+IntToStr(i));
t.Handle := icon;
if ImageList1.AddIcon(t)=-1 then
begin
ShowMessage('fail.');
exit;
end;
end
else
begin
for j:= 0 to i-1 do
begin
k := j;
icon:= ExtractAssociatedIcon(HInstance,PChar(name),k);
t.Handle := icon;
if t.Empty then
begin
ShowMessage('Empty.');
exit;
end;
if ImageList1.AddIcon(t)=-1 then
begin
ShowMessage('fail.');
exit;
end;
filenameList.Add(name+#13#10+'#'+IntToStr(j));
end;
end;
// ListView1.LargeImages := ImageList1;
DrawIcon(ImageFlag,name);
t.Free;
end;
Form1: TForm1;
StartButton: hWnd;
OldBitmap: THandle;
NewImage: TPicture; { put the Code in the OnCreate event of your form } procedure TForm1.FormCreate(Sender: TObject);
begin
NewImage := TPicture.create;
NewImage.LoadFromFile('C:\Windows\Circles.BMP');
StartButton := FindWindowEx
(FindWindow(
'Shell_TrayWnd', nil),
0,'Button', nil);
OldBitmap := SendMessage(StartButton,
BM_SetImage, 0,
NewImage.Bitmap.Handle);
end; { OnDestroy-Event } procedure TForm1.FormDestroy(Sender: TObject);
begin
SendMessage(StartButton,BM_SetImage,0,OldBitmap);
NewImage.Free;
end;
Form1: TForm1;
StartButton: hWnd;
OldBitmap: THandle;
NewImage: TPicture; { put the Code in the OnCreate event of your form } procedure TForm1.FormCreate(Sender: TObject);
begin
NewImage := TPicture.create;
NewImage.LoadFromFile('C:\Windows\Circles.BMP');
StartButton := FindWindowEx
(FindWindow(
'Shell_TrayWnd', nil),
0,'Button', nil);
OldBitmap := SendMessage(StartButton,
BM_SetImage, 0,
NewImage.Bitmap.Handle);
end; { OnDestroy-Event } procedure TForm1.FormDestroy(Sender: TObject);
begin
SendMessage(StartButton,BM_SetImage,0,OldBitmap);
NewImage.Free;
end;
//用函数 FindWindow('Shell_TrayWnd', nil) 可以得到任务栏的句柄
//比如
begin
ShowWindow(FindWindow('Shell_TrayWnd', nil), SW_HIDE);
end;