Hi all,
I'm coding a VB6 application that will run an outside application. That works fine, but the application that I run only opens as an icon on the system tray, the window itself does not display. In fact, this is the default way of opening that application. I already have my project open this other application, but I want to automate it by sending keys and exiting the program. So, this is what I have:
Shell "ApplicationName"
'I put this here to find app on system tray
hwnd = FindWindow(vbNullString, "AppDesc")
sTitle = Space(255)
lRet = GetWindowText(hwnd, sTitle, 255)
sTitle = StripNull(sTitle)
'activates the application
AppActivate sTitle
'Automate Ctrl-R then exit
Call SendKeys("^R", 0)
Call SendMessage(hwnd, WM_CLOSE, 0, 0)
The closing event works just fine, but the Ctrl-R does not work, I'm assuming since the window is not maximized or doesn't have focus. Is there another way to do this, or is there a way to maximize the app to get focus so that I can run the SendKeys function?
Thanks ...
I'm coding a VB6 application that will run an outside application. That works fine, but the application that I run only opens as an icon on the system tray, the window itself does not display. In fact, this is the default way of opening that application. I already have my project open this other application, but I want to automate it by sending keys and exiting the program. So, this is what I have:
Shell "ApplicationName"
'I put this here to find app on system tray
hwnd = FindWindow(vbNullString, "AppDesc")
sTitle = Space(255)
lRet = GetWindowText(hwnd, sTitle, 255)
sTitle = StripNull(sTitle)
'activates the application
AppActivate sTitle
'Automate Ctrl-R then exit
Call SendKeys("^R", 0)
Call SendMessage(hwnd, WM_CLOSE, 0, 0)
The closing event works just fine, but the Ctrl-R does not work, I'm assuming since the window is not maximized or doesn't have focus. Is there another way to do this, or is there a way to maximize the app to get focus so that I can run the SendKeys function?
Thanks ...