if winexec(pchar('e:\kqglxt> copy\\2111\数据库更新\dbkqgl.mdb /y'),sw_hide)=true then showmessage('数据库更新已完成!') else showmessage('数据库更新未完成!')不好意思,以上的语句是不是有很大的问题,但是我不知道该怎么写,请改正。
用语句生成一个 cmd 文件,CMD 是在DOS上运行的命令行文件。往这个文件里写你要运行的所有命令,包括什么 copy del 之类的,然后 shellexecute 这个文件就可以
runstr:='isql -S ' + sname + ' -i ' + pUnit.getPath + '\database\createdb.sql -U ' + uname + ' -P ' + upwd; AssignFile(F1,getPath + '\database\setup.cmd'); rewrite(f1); write(f1,runstr); closeFile(f1); If MessageBox(0,'Are you ready to create database?' + #13+#13 + 'Remember:'+#13+' If you had already created,redo this will destroy all your data.','Message',MB_YESNO)=IDYES then begin Messagebox(0,' Please wait a several seconds... ','Message',MB_OK); ShellExecute(0,'',PChar(pUnit.getPath + '\database\setup.cmd'),nil,nil,SW_NORMAL); end;
The CreateProcess function creates a new process and its primary thread. The new process executes the specified executable file. BOOL CreateProcess( LPCTSTR lpApplicationName, // pointer to name of executable module LPTSTR lpCommandLine, // pointer to command line string LPSECURITY_ATTRIBUTES lpProcessAttributes, // pointer to process security attributes LPSECURITY_ATTRIBUTES lpThreadAttributes, // pointer to thread security attributes BOOL bInheritHandles, // handle inheritance flag DWORD dwCreationFlags, // creation flags LPVOID lpEnvironment, // pointer to new environment block LPCTSTR lpCurrentDirectory, // pointer to current directory name LPSTARTUPINFO lpStartupInfo, // pointer to STARTUPINFO LPPROCESS_INFORMATION lpProcessInformation // pointer to PROCESS_INFORMATION );
你好!我把你的语句加入后,点击后怎么设置提示,数据库更新完成呢?不过,好象这个语句没有执行。
谢谢,请告诉我是哪儿做的有问题,好吗?
winexec(pchar('e:\kqglxt> copy\\2111\数据库更新\dbkqgl.mdb /y'),sw_hide)=true
then
showmessage('数据库更新已完成!')
else
showmessage('数据库更新未完成!')不好意思,以上的语句是不是有很大的问题,但是我不知道该怎么写,请改正。
不好意思,我还是不懂耶,能不能写一下,谢谢你了,我太笨了。
AssignFile(F1,getPath + '\database\setup.cmd');
rewrite(f1);
write(f1,runstr);
closeFile(f1);
If MessageBox(0,'Are you ready to create database?' + #13+#13 + 'Remember:'+#13+' If you had already created,redo this will destroy all your data.','Message',MB_YESNO)=IDYES then
begin
Messagebox(0,' Please wait a several seconds... ','Message',MB_OK);
ShellExecute(0,'',PChar(pUnit.getPath + '\database\setup.cmd'),nil,nil,SW_NORMAL);
end;
LPTSTR lpCommandLine, // pointer to command line string
LPSECURITY_ATTRIBUTES lpProcessAttributes, // pointer to process security attributes
LPSECURITY_ATTRIBUTES lpThreadAttributes, // pointer to thread security attributes
BOOL bInheritHandles, // handle inheritance flag
DWORD dwCreationFlags, // creation flags
LPVOID lpEnvironment, // pointer to new environment block
LPCTSTR lpCurrentDirectory, // pointer to current directory name
LPSTARTUPINFO lpStartupInfo, // pointer to STARTUPINFO
LPPROCESS_INFORMATION lpProcessInformation // pointer to PROCESS_INFORMATION
);
你好!
我是要把这个功能加到程序里,好象是要调用外部函数的,是不是啊?
要不你教的语句要加到哪儿啊