win98下怎么共享硬盘。(100分)

  • 主题发起人 主题发起人 2days
  • 开始时间 开始时间
2

2days

Unregistered / Unconfirmed
GUEST, unregistred user!
大家好,我搜索到了,这个贴子<br>http://www.delphibbs.com/delphibbs/dispq.asp?lid=1281458<br>然后照着里面的做了<br>可是运行后,总是提示Error:124,请问哪里错了,是什么问题<br><br>unit Unit1;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br>&nbsp; StdCtrls;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; Button1: TButton;<br>&nbsp; &nbsp; procedure Button1Click(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>const<br>&nbsp; NETNAME_LEN = 13;<br>&nbsp; PASSWORD_LEN = 9;<br><br>&nbsp; SHI50F_RDONLY = $0001;<br>&nbsp; SHI50F_FULL = $0002;<br>&nbsp; SHI50F_DEPENDSON = $0003;<br>&nbsp; SHI50F_ACCESSMASK = $0003;<br>&nbsp; SHI50F_PERSIST = $0100;<br>&nbsp; SHI50F_SYSTEM = $0200;<br><br>&nbsp; STYPE_DISKTREE = 0;<br>&nbsp; STYPE_PRINTQ = 1;<br>&nbsp; STYPE_DEVICE = 2;<br>&nbsp; STYPE_IPC = 3;<br><br>&nbsp; NERR_Success = 0;<br>&nbsp; NERR_BASE = 2100; //常量说明<br>&nbsp; NERR_UnKnownDevDir = (NERR_BASE + 16);<br>&nbsp; NERR_UnknownServer = (NERR_BASE + 3);<br>&nbsp; NERR_ServerNotStarted = (NERR_BASE + 14);<br>&nbsp; NERR_RedirectedPath = (NERR_BASE + 17);<br>&nbsp; NERR_DuplicateShare = (NERR_BASE + 18);<br>&nbsp; NERR_BufTooSmalll = (NERR_BASE + 23);<br>type<br>&nbsp; TSHARE_INFO_50 = record<br>&nbsp; &nbsp; netname: array[0..NETNAME_LEN - 1] of Char;<br>&nbsp; &nbsp; sharetype: ShortInt;<br>&nbsp; &nbsp; flags: SmallInt;<br>&nbsp; &nbsp; remark: PChar;<br>&nbsp; &nbsp; path: PChar;<br>&nbsp; &nbsp; rw_password: array[0..PASSWORD_LEN - 1] of Char;<br>&nbsp; &nbsp; ro_password: array[0..PASSWORD_LEN - 1] of Char;<br>&nbsp; end; //以上为类型定义<br><br>function NetShareAdd(ServerName: PWideString; Level: Dword;<br>&nbsp; Buffer: pByte; ParamError: pDword): SmallInt;<br><br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br><br>{$R *.DFM}<br>function NetShareAdd; external 'svrapi.DLL' name 'NetShareAdd';<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp; i: integer;<br>&nbsp; si: TSHARE_INFO_50;<br>&nbsp; parm_err: DWord;<br>begin<br>&nbsp; si.netname := 'save';<br>&nbsp; si.shareType := STYPE_DISKTREE;<br>&nbsp; si.flags := SHI50F_FULL;<br>&nbsp; si.remark := nil;<br>&nbsp; si.path := 'D:/temp/';<br>&nbsp; si.rw_password := '';<br>&nbsp; si.ro_password := '';<br>&nbsp; i := NetShareAdd(nil, 50, pbyte(@si), @parm_err);<br>&nbsp; if (i &lt;&gt; NERR_Success) then<br>&nbsp; &nbsp; showmessage('Error:' + inttostr(i));<br>end;<br>end.<br>
 
这个就不知道了,我一般直接通过修改注册表实现
 
你好,通过注册表,不是还要重新启动????
 
晕,怎么把分给出去了:(
 
哈~<br>改了注册表以后好象可以这样<br>SendMessage(FindWindow('Progman', 'Program Manager'), WM_COMMAND, 106597,0);
 
后退
顶部