链接已复制
See ShellExecuteEx; after you call it, you can use WaitForSingleObject on SEI.hProcess (see docs). Note, however, that your application will appear to be non-responding while waiting for Excel to terminate.
Jugoslav
Thanks, but I'm struggling with this. I can't seem to use this without defining shellinfoexec, and when I do, it complains it doesn't match the dummy argument. I'm probably not undertanding the structure definition properly anyway, not being a C programmer. No includesor use statments seem to help.
Any further clues would be greatly appreciated.
Quick sketch:
USE DFWIN
type (T_SHELLEXECUTEINFO):: SEI !CVF api translations have T_ prefix
SEI%cbSize = SIZEOF(SEI)
SEI%fMask = SEE_MASK_NOCLOSEPROCESS
SEI%lpVerb = NULL ! = open
SEI%lpFile = LOC("whatever.xls")C !LP*STR's in TYPEs require LOC
IF (ShellExecuteEx(SEI) .EQ.0) THEN
iErr = GetLastError()
ELSE
i = WaitForSingleObject(SEI%hProcess, INFINITE)
i = CloseHandle(SEI%hProcess)
END IF
HTH
Jugoslav
