把一个文件夹模似成一个逻辑盘在我的电脑上显示,也是原来DOS下的SUBST.EXE程序的功能。用DELPHI如何实现?用DELPHI代码实现。
解决方案 »
- 使用TIdTCPServer做服务端口,使用TIdTCPClient做客户端,客户端readln一行后,使用Disconnect断开连接。
- 请教SOCKET通讯协议的问题
- 请问大家 运行时包与设计时包的区别
- 怎么实现image1图像的淡入淡出
- 请问:如何让子父窗口的子窗口只打开一次?
- 各位:学习delphi相应的数据库应学习Oracle还是DB2,还是Ms sql?
- 数据库,sql语句的问题,谢谢 Online..
- 我用listview显示的数据,怎么实现点击标题实现排序,我就这么多分了,请高手帮忙
- 控件不见了
- 关于DELPHI调用WEBSERVICE时,调试正常,正常执行报错!
- 客户端无法执行Update语句,但有些机子又可以,这是怎么回事?
- 初学!问一个数据库的问题 谢谢
SysUtils,Windows;
type
TAction=(aAdd,aResign,aRemove,aQuery);
var Action:TAction;
Root:String;
Driver:string;
procedure ShowHelp;
const
HelpStrs:array[1..9] of String=
(
'drive [option] [root] [driver]',
' [Option] could be:',
' --add add a driver',
' --reassign modify a existing driver',
' --remove remove a existing driver',
' [root] must be two character like C: D:',
' [driver] is a valid driver',
'',
' Made by SoMaNyTiMeS(lex chou)'
);
var i:Integer;
begin
for i:=Low(HelpStrs) to High(HelpStrs) do
Writeln(HelpStrs[i]);
halt;
end;
procedure ShowError(const s:string);
begin
writeln('ERROR:'+s);
halt;
end;
procedure AnalysisParameters;
var Options:string;
begin
if not (ParamCount in [2,3]) then ShowHelp;
Options:=ParamStr(1);
if CompareText(Options,'--add')=0 then
Action:=aAdd
else
if CompareText(Options,'--resign')=0 then
Action:=aResign
else
if CompareText(Options,'--remove')=0 then
Action:=aRemove
else
if CompareTExt(Options,'--query')=0 then
Action:=aQuery
else
ShowError('Unrecognizable parameters!');
Root:=ParamStr(2);
if ParamCount=3 then
Driver:=ParamStr(3)
else
Driver:='';
if Length(Root)<>2 then ShowError('root must be two character');
if (not (Root[1] in ['A'..'Z','a'..'z'])) or
(root[2]<>':') then
ShowError('Invalid root format!');
if Action in [aQuery,aRemove] then
begin
if ParamCount<>2 then
ShowError('This operation require two parameters!')
end
else
if (ParamCount<>3) or (length(ParamStr(3))=0) then
ShowError('This operation require three parameters!');
end;
function QueryDriver(c:Char):string;
var Buffer:array[1..200] of char;
begin
FillChar(Buffer,200,0);
QueryDosDevice(PChar(String(c)+':'),PChar(@Buffer),200);
Result:=StrPas(@Buffer);
end;
procedure AddDrive;
begin
DefineDosDevice(DDD_RAW_TARGET_PATH,PChar(Root),PChar(Driver));
end;
procedure Remove;
begin
if Length(QueryDriver(Root[1]))=0 then
ShowError('Driver is not existing!');
DefineDosDevice(DDD_RAW_TARGET_PATH,PChar(Root),'');
end;
procedure Resign;
begin
if Length(QueryDriver(Root[1]))=0 then
ShowError('Driver is not existing!');
AddDrive;
end;
procedure DoAction;
begin
case Action of
aAdd:AddDrive;
aResign:Resign;
aRemove:Remove;
aQuery:writeln(QueryDriver(Root[1]));
end;
end;
begin
{ TODO -oUser -cConsole Main : Insert code here }
AnalysisParameters;
DoAction;end.
后面要加参数,例如
mydriver /add z: c:\Windows
mydriver --add z: c:\windows
我是 win2003
我的是win2000
mount -o loop 文件 /mnt/file
访问/mnt/file就可以修改此文件
相应得还有
\Device\Cdrom1
等.可以通过 --query 参数查询
為什麼不看看我的鏈接??
其實用的函數是一樣的, 只不過處理有點不同而已
你的连接?我没有找到这方面内容啊。
我找不到相关的内容啊。请指点。谢谢!
这个我早就用了,运行WIN9X,2000,XP
能控制读写