|
-
Jun 27th, 2001, 02:01 PM
#1
Thread Starter
Addicted Member
Use SHELL to open a program, but what to CLOSE it ?
Use SHELL to open a program, but what to CLOSE it ?
OK, I have a stupid question ....
I want to close a program I call from my app. I cant figure it out !
Lets say I use Shell to open it, and get its AppId ... How can I use that AppId to close that instance of that program ?
I have tried and tried to even use AppActivate and sendkeys, but for some unknown reason appactivate wont work anymore from my app. Says error 5, object not found or some stupid crap. But regaurdless, I dont care about appactivate, I just want to close the AppId I call from shell.... Not a hard problem, right ? :-)
Ok, and another quick question is, lets say I shell IEXPLORE.EXE and want to send a new string to the SAME APPID, not a new instance of the program (Navigate to another site from THE app I called, not a new one) - how can that be acomplished ? I dont even know where to begin with that one...
Thanks to all !
BaLLZaCH
[email protected]
Visual Basic 5 and 6
-
Jun 27th, 2001, 07:11 PM
#2
New Member
you can use the Link stuff off of a dummy text box to navigate a browser that's already open:
Code:
Text1.LinkTopic = "iexplore|WWW_OpenURL"
Text1.LinkItem = URL & ",," & &HFFFFFFFF & "," & &O7
Text1.LinkMode = vbLinkManual
Text1.LinkRequest
for ending a process, if you know the handle, you can use the TerminateProcess API, or use the PostMessage API with a WM_Close message. Sorry, don't have any code for that.
-
Jun 28th, 2001, 01:32 AM
#3
Addicted Member
-
Jun 28th, 2001, 08:50 AM
#4
Thread Starter
Addicted Member
thanks bro
-
Jun 28th, 2001, 09:08 AM
#5
Thread Starter
Addicted Member
Well, thanks a lot for helping, but ...
Thats not exactly what I was looking for :-( ....
Basically, ok well, here is some sample code:
If I want to shell a program, and then close it - why cant it be as simple as this :
private sub kissmyass()
dim taskid
taskid = shell(program.exe, 1)
timer1.interval = 1000
timer1.enabled = true
end sub
'Ok, now we will wait 1 second
'then what I am looking for is a call, API or what be it,
'to close that app
timer1_timer
redim taskid
'Theoretically
"close taskid"
'just like appactivate, but CLOSE
end
end sub
I have tried and used the _close and several other Microsoft Help methods, but the problem is that all these methods require that you know the title bar off the app. Now I realize I can retreive the title bar from the task id, but the problem there is that if you have 2 of the same apps open, there is no telling which one windows is gonna decide to close. I jsut want to close the app directly from the task id.... (I even tried the TASK MANAGER method of closing, but there again you have to have the name of the title bar)
And about the second question, lets say a user has explorer open, and I want to use that window to navigate to my site ... NOT open a new window - I want to send a string to that open window without shelling a new one ... The same thing as typing:
iexplore.exe http://www.site.com
from command line, BUT not shelling a new app - using the existig window. How can I send that http string to the open window ?
Anyway, thanks for helping people's ... I do appriciate it.
Thanks. BaLLZaCH
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|