提问个简单编程问题,送100分

sun0816 2002-10-30 09:37:28
在VFP6.0环境中编程,执行以下程序代码:假设当前目录情况为c:\vfp98\ku1.dbf
在程序中,我想要把该表中的记录备份到A盘。
if messagebox("请将磁盘插入A驱中,选择[确定],否则选择[去消]",1+32,"操作提示")=1
copy file ku1.dbf to A:\ku1.dbf
endif
在此提出的问题是:如果未将磁盘插入A驱中,或者磁盘出现零磁道损坏,而无法进行此备份操作,如何才能判断用户已经把磁盘插入A驱,或者报告磁盘损坏。
...全文
41 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
sun0816 2002-11-03
  • 打赏
  • 举报
回复
楼上老兄出的程序段是行不通的,磁盘不存A驱内时,并不会出现wait语句提示的信息,而是出现系统级错误提示,而且无法达上面我提出的任务目的。
我想还是在ON ERROR上想办法好。
liuri璇玑 2002-10-31
  • 打赏
  • 举报
回复
if diskspace('a:')=-1
wait '未将磁盘插入A驱中,或者磁盘出现零磁道损坏,无法进行此备份操作!'windows
endif
jmkwok 2002-10-30
  • 打赏
  • 举报
回复
* *****************************************************************
* FUNCTION isdiskin
******************************************************************
* Parameters - Driver root directory, such as "A:\", "B:\" etc.
* Return - If diskette in floppy disk driver, return .T. otherwiase return .F.
* Usage - IsDiskIn("A:\")
* Description - All disk driver has a none zero system volumn ID, if the specified
* disk driver does not existed a 0 will be returned. So, the win32api
* function GetVolumeInformation() will take place with the old
* Foxpro for DOS 's IsDiskIn.Bin
* *****************************************************************
FUNCTION IsDiskIn
PARAMETERS tcRootPath
LOCAL cRootPath, cVolName, nVolNameLen, nVolumeSerialNumber, nMaxFileNameLen, nFileSystemFlags, cFileSystemName, nFSNameLen
cRootPath = tcRootPath
cVolName = SPACE(255)
nVolNameLen = LEN(cVolName)
nVolumeSerialNumber = 0
nMaxFileNameLen = 0
nFileSystemFlags = 0
cFileSystemName = SPACE(255)
nFSNameLen = LEN(cFileSystemName)

=GetVolInfo(cRootPath, @cVolName, nVolNameLen, ;
@nVolumeSerialNumber, @nMaxFileNameLen, ;
@nFileSystemFlags, @cFileSystemName, nFSNameLen)

IF nVolumeSerialNumber = 0
RETURN (.F.)
ELSE
RETURN (.T.)
ENDIF

2,749

社区成员

发帖
与我相关
我的任务
社区描述
VFP,是Microsoft公司推出的数据库开发软件,用它来开发数据库,既简单又方便。
社区管理员
  • VFP社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧