The external program is often called in the PB and waits for this program to display relevant information after running. As we have to back up the Adaptive Server Anywhere 6.0 database, display the "Backup Complete!" After the backup is completed. If you immediately use the Messagebox display prompt information immediately after calling the backup program dbackup, this happens when the program is running: DBBackup The backup program is still running, "Backup is complete!" The prompt has been displayed, apparently does not meet our ideas. For this case, we can solve it with the API function FindWindowa (), iswindow (), and PB itself function yield ().
Declare API function:
Function Long Findwindowa (String LpWindownAme) library "user32.dll"
Function Boolean Iswindow (long hwnd) library "user32.dll"
transfer:
Ulong LL_Handle
INT Li_LOOP
SetPointer (HOURGLASS!) // Set the mouse pointer
/ / Run Backup Database Program DBBackup and minimize it
Run ("dbbackup -c ~" UID = DBA; PWD = SQL; DBF = D: / Sybase / Adaptive Server Anywhere 6.0 / Asademo.db ~ "D: / backup", minimized!)
LL_Handle = 0
// loop to the dbbackup window
Do While Ll_Handle = 0
LL_Handle = FindWindowa ("TTY", "DBBACKUP")
Yield () //
loop
// Waiting for the DBBackup window to close
Do while iswindow (ll_handle)
Yield ()
Loop
// Application execution completion
Messagebox ("
Tip information
","
Backup completion
! ")