而重新开机,则行运行了程序,为什么,百思不得其解。有没见过这种问题的朋友。
解决方案 »
- 基础问题,麻烦给看看.解决给分.
- 关于变量、函数等:用全局变量、函数好 还是 成员变量、方法比较好?
- 酒店管理系统
- 请各位看看我的代码是那错了
- 想使用系统时间作一个文件的名字,设置了datetimepicker1的format为‘yyyyMMddHHmmss',保存时不对了。
- 怎么用sql查询ACCESS中的日期时间的数据
- 注销windows帐号
- Excel导出的问题:数据能倒出来,但Excel却是半死机状态。。。
- 如何让菜单的某一项的下拉中的某一项前面有一个对号???
- 急急急!哪儿有POffice 97 or 2000下载????一开始下载就给分!!!!!
- 怎样获得Dialog中跳出选择文件的框后,如果按了取消键的信息
- delphi 中的paradox的使用
正如 bigchg(戴着戒指) 所述
如果你的打印机放在WIN2K中,
其它的计算机如果要打印必须先访问一下这台WIN2K才能打印,
总不能让用户每次开机后就认证一次吧
请问你们是怎么解决的呢?]
bigchg(戴着戒指)
什么是去系问问,?
◆◆◆ CSDN查询助手,查询方便快捷◆◆◆ 下载地址:
http://CoolSlob.ifood1.com/Download/CSDNFinder.exe
http://CoolSlob.8u8.com/Download/Tools/CSDNFinder.Slob[更名为.exe即可]
http://CoolSlob.ifood1.com/Download/Demo.exe1.输入Server的用户名与密码,
2.输入Server端的任何一个共享目录
3.Connect
4.再运行你的程序看看,
如果这样可以解决的问题的话,我再找代码,
没用的活我就不费心思去找了:)
var
RetCode: LongInt;
ErrStr: String;
begin
RetCode := MapDrive(EDrive.Text, ERemoteName.Text, EUserName.Text, EPassword.Text, ErrStr);//在Dial单元应用
MRetMsg.Clear;
MRetMsg.Lines.Add(ErrStr);
end;
/////////这是Dial单元/////////
unit Dial;interfaceuses Windows; function MapDrive(const LocalName, RemoteName, UserName, Password: string; var ErrMsg: string): LongInt;
function DelDrive(const LocalName: string; const Force: Boolean; var ErrMsg: string): Longint;implementationfunction MapDrive(const LocalName, RemoteName, UserName, Password: string; var ErrMsg: string): LongInt;
var
lpNetResource: TNetResource;
begin
lpNetResource.dwType := RESOURCETYPE_DISK;
lpNetResource.lpLocalName := PChar(LocalName);
lpNetResource.lpRemoteName := PChar(RemoteName);
lpNetResource.lpProvider := Nil;
Result := WNetAddConnection2(lpNetResource,
PChar(Password), PChar(UserName), 0); case Result of
ERROR_ACCESS_DENIED: ErrMsg := 'Access to the network resource was denied.';
ERROR_ALREADY_ASSIGNED: ErrMsg := 'The local device specified by lpLocalName is already connected to a network resource.';
ERROR_BAD_DEV_TYPE: ErrMsg := 'The type of local device and the type of network resource do not match.';
ERROR_BAD_DEVICE: ErrMsg := 'The value specified by lpLocalName is invalid.';
ERROR_BAD_NET_NAME: ErrMsg := 'The value specified by lpRemoteName is not acceptable to any network resource provider. The resource name is invalid, or the named resource cannot be located.';
ERROR_BAD_PROFILE: ErrMsg := 'The user profile is in an incorrect format.';
ERROR_BAD_PROVIDER: ErrMsg := 'The value specified by lpProvider does not match any provider.';
ERROR_BUSY: ErrMsg := 'The router or provider is busy, possibly initializing. The caller should retry.';
ERROR_CANCELLED: ErrMsg := 'The attempt to make the connection was cancelled by the user through a dialog box from one of the network resource providers, or by a called resource.';
ERROR_CANNOT_OPEN_PROFILE: ErrMsg := 'The system is unable to open the user profile to process persistent connections.';
ERROR_DEVICE_ALREADY_REMEMBERED: ErrMsg := 'An entry for the device specified in lpLocalName is already in the user profile.';
ERROR_EXTENDED_ERROR: ErrMsg := 'A network-specific error occured. Call the WNetGetLastError function to get a description of the error.';
ERROR_INVALID_PASSWORD: ErrMsg := 'The specified password is invalid.';
ERROR_NO_NET_OR_BAD_PATH: ErrMsg := 'A network component has not started, or the specified name could not be handled.';
ERROR_NO_NETWORK: ErrMsg := 'There is no network present.';
NO_ERROR: ErrMsg := '连接成功';
else ErrMsg := '连接失败,发生未知错误';
end;
end;function DelDrive(const LocalName: string; const Force: Boolean; var ErrMsg: string): Longint;
begin
Result := WNetCancelConnection2(PChar(LocalName), 0, Force);
case Result of
ERROR_BAD_PROFILE: ErrMsg := 'The user profile is in an incorrect format.';
ERROR_CANNOT_OPEN_PROFILE: ErrMsg := 'The system is unable to open the user profile to process persistent connections.';
ERROR_DEVICE_IN_USE: ErrMsg := 'The device is in use by an active process and cannot be disconnected.';
ERROR_EXTENDED_ERROR: ErrMsg := 'A network-specific error occurred. To get a description of the error, use the WNetGetLastError function.';
ERROR_NOT_CONNECTED: ErrMsg := 'The name specified by the lpName parameter is not a redirected device, or the system is not currently connected to the device specified by the parameter.';
ERROR_OPEN_FILES: ErrMsg := 'There are open files, and the fForce parameter is FALSE.';
NO_ERROR: ErrMsg := '连接成功';
else ErrMsg :
这里你仅仅是为了验证!所以空比较好btw:CoolSlob死了!
详见:http://expert.csdn.net/Expert/TopicView1.asp?id=1060196================================================================
◆◆◆ CSDN查询助手,查询方便快捷◆◆◆ 下载地址:
http://CoolSlob.ifood1.com/Download/CSDNFinder.exe
http://CoolSlob.8u8.com/Download/Tools/CSDNFinder.Slob[更名为.exe即可]
非常感谢你 ,我的问题已经解决
我想问你的事,象这种情况,有种不好的地方是要在程序中帮定
server 的window的用户名和密码
以后有可能改动它的用户名和密码,那我的程序也要改,虽然可以把这些
信息放在表里或注册表里,也要改相应的信息 ,请问,还有别的方法吗?
不用那个API函数能做到吗? 再次表示感谢!