Exiting a program spawned within another by sending keystrokes.
Posted on 2000-03-07
Help. I'm not up on VB. I recently recompiled a VB3 app that basically opens Paint Shop, pulls in a TGA, gamma corrects it, resizes it, then reduces the color depth, then saves it to the network. The app is called from within the vb app and fed keystrokes within a loop. That part works fine, except, the app (Paint shop pro) does not close at the end of the loop. It used to under 3.1, but now under 98 it creates a new copy of Paint shop pro with each iteration of the loop. Here is the significant code snippet that feeds the keystrokes:
Private Sub Timer1_Timer()
RTime = RTime + 1
Select Case RTime
SendKeys "%CA2.1~" ' Gamma Correct
SendKeys "%IZ" ' Resize Image
SendKeys "%4O" ' 640 x 480
SendKeys "%CD5E~" ' 256 Colors
SendKeys "%FS" ' Save File As
SendKeys "X:\FA\IMAGES\" ' Save Directory for BMPs
SendKeys Products.List(Prod_No) ' Product Directory
SendKeys Prefixes.List(Pre_No) ' Proper PreFix
A = Trim(TGAs.List(TGA_No)) ' File Name
A = Mid$(A, 1, Len(A) - 4)
A = A & ".BMP"
SendKeys "~" ' Save It
SendKeys "%FXNNN" ' Exit PaintShop
Resize = False
Timer1.Enabled = False
RTime = 0
Delay_Flag = False
What can I do to fix this?