Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening outside applications

Status
Not open for further replies.

droot

Programmer
Joined
Jun 6, 2005
Messages
2
Location
US
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 ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top