I need to find a way to shut down my applications within a time limit...
i got the timer and the time stuff to work, and i looked at all the other ppl tellin about how to shutdown an application, now my only problem is that when i create that code snippet for closing the application...
For Each proc As Process In Process.GetProcessesByName("Counter-Strike Source")
Application.Exit()
then it only comes to the first line, checks the name, and then stops... doesnt actually quit counter strike, lol... i play too much n cant stop, this is my way of stopping myself...
So how do i find the friendly name to do this

how do you find the friendly name of an application???
Joymach
i found this code in the help index of VB:
Dim pList() As System.Diagnostics.Process = _
System.Diagnostics.Process.GetProcesses
For Each proc As System.Diagnostics.Process In pList
MsgBox(proc.ProcessName)
Next
That showed me all the processes, and all the names without the *.exe or whatever...
so i thought that might be it, then i had seen your reply just b4 n then i was sure... and IT WORKED!!! lol
well, this was my final closing code:
For Each proc As Process In Process.GetProcessesByName("hl2")
proc.CloseMainWindow()
Next
Thank you!
Jose Eloy
Hey BullZhot,
Counter-Strike:Source is running from within HL2, so if you look in your 'process manager', u see hl2.exe, and that is the program you have to stop.
So maybe you could try:
For Each proc As Process In Process.GetProcessesByName("hl2.exe") Or Process.GetProcessesByName("hl2")
proc.Exit()
Next
Grtz, Tom.
PS: I am not sure about the Or-part, as I couldn't test it while writing this reply.
John Justice - MSFT
loooool
ohhhhhh counter strike is a game, i thought you build an application and called it counter strike sorry
i don't know how to close it
best regards
PAVEL FRANCE PPC
anyway, you could still help, cuz it quits when you press F10 while in the game, so if you have some way that the form im makin can press F10 then it would still work, lol...
anyway, it still helped me, all that you said... thank you
Andreas Haeusler
hi,
the last thing , your application depend on the first form that run, for example form1 is your application if you closed form1 the entire application will be closed
so you can close the startup form in your application to abort,
or you can use application.exit
this is form2 i can close form1 or exit the application both are working
Public
Class Form2 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'Form1.Close()Application.Exit()
End SubEnd
Classhope this helps
Bob W
hi,
to find out the process name open task manager by clicking Ctrl + alt + delete , then go to processes and find your application there
you can use "Me.Close()"
hope this helps
AlvinTheUnready
only... now i use security task manager which is a lot better a long w windows task manager, to get more info abt tasks...
what i mean is...
both when using the name given under the applications in windows task manager, and under processes, nothing happens.... still not working....
but I will try the "Me.Close()" statement...
nope... not workin....
this is the default code for the snippet i use:
For Each proc As Process In Process.GetProcessesByName("Untitled - Notepad")
proc.CloseMainWindow()
Next
Even when I try to do this, it doesn't work, I believe the "Untitled - Notepad" must be the friendly name of an untitled notepad document, lol... but it still wont find it n close it, yes, i did open an untitled notepad, a new notepad document, but it didnt find it and didnt close it. even with the extra Application.Close() and the Me.Close(), still, nothing.
the snipped i used was:
Insert snippet>interactions with the application>stop an application
that gave me the code:
For Each proc As Process In Process.GetProcessesByName("Untitled - Notepad")
proc.CloseMainWindow()
Next
which wont work...
smo, plz help, hope to hear from that smo soon....
complete_blue
No problem mate :p
Just wasn't sure about my code,
but the post was ment to show you that you should close hl2.exe, and not CS:S.
Grtz, Tom.
PS: maybe u should send me a mail, to play together once ;)
Phil Miller
but i'd like it if just the application would close...
in fact, if smo could just tell me how to close any applilcation like that, like the Untitled - Notepad thing, then i think i might be able to figure the rest out on my own...
thanks again
bigjimslade
lol do you want to close your application or other application like notepad
best regards
Koo Ofori
hate makin myself clear in english, or in any language really... I try to say everything i did or tried and just makes it more confusin, lol....
i hope this helps...
ssteinberg
thanks for the help, the thing about "Untitled - Notepad" just put me off completely, since that was like the default name n stuff... oh well, ill try n send you a mail to the address i think you have, lol...
else, in CS:S my friends name is "BullZhot[DK]" exactly like that, you can add me if i didnt guess your mail right, lol... n you certainly wont guess mine, hav nothin to do w any of the info in here, lol...