473,795 Members | 3,393 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to terminate process started using the Shell function

I've looked high and low, but I can't seem to find an answer. When I open an
application using the shell command, as seen below, how can I close the
application? I am creating a menu system for powerpoint presentations and
they all loop. I need to stop one presentation before I staer another. I
considered using New Process to start the application, but I don't seem to
be able to pass command line arguments.

ProcID = Shell("""C:\Pro gram Files\Microsoft Office\PowerPoi nt
Viewer\PPTVIEW. EXE"" /s c:\testfiles\te st.ppt", AppWinStyle.Nor malNoFocus)

Any help would be appreciated,

John
Aug 28 '07 #1
2 10804
In article <#L************ **@TK2MSFTNGP04 .phx.gbl>,
mi*******@jabte ch.com says...
I've looked high and low, but I can't seem to find an answer. When I open an
application using the shell command, as seen below, how can I close the
application? I am creating a menu system for powerpoint presentations and
they all loop. I need to stop one presentation before I staer another. I
considered using New Process to start the application, but I don't seem to
be able to pass command line arguments.

ProcID = Shell("""C:\Pro gram Files\Microsoft Office\PowerPoi nt
Viewer\PPTVIEW. EXE"" /s c:\testfiles\te st.ppt", AppWinStyle.Nor malNoFocus)
Dim pr as Process = Process.GetProc essByID(ProcID)
pr.Kill() ' or pr.CloseMainWin dow()

--
Patrick Steele (pa*****@mvps.o rg)
http://weblogs.asp.net/psteele
Aug 28 '07 #2
Thanks, worked like a charm.

John

"Patrick Steele" <pa*****@mvps.o rgwrote in message
news:MP******** *************** *@msnews.micros oft.com...
In article <#L************ **@TK2MSFTNGP04 .phx.gbl>,
mi*******@jabte ch.com says...
>I've looked high and low, but I can't seem to find an answer. When I open
an
application using the shell command, as seen below, how can I close the
application? I am creating a menu system for powerpoint presentations and
they all loop. I need to stop one presentation before I staer another. I
considered using New Process to start the application, but I don't seem
to
be able to pass command line arguments.

ProcID = Shell("""C:\Pro gram Files\Microsoft Office\PowerPoi nt
Viewer\PPTVIEW .EXE"" /s c:\testfiles\te st.ppt",
AppWinStyle.No rmalNoFocus)

Dim pr as Process = Process.GetProc essByID(ProcID)
pr.Kill() ' or pr.CloseMainWin dow()

--
Patrick Steele (pa*****@mvps.o rg)
http://weblogs.asp.net/psteele

Aug 28 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3348
by: Blue in Green | last post by:
Hi, How can I check whether a program, started with the 'shell' function, has terminated? Can this be done with value, returned from the shell function? Thx Marc
2
1365
by: MrKrich | last post by:
I use shell function to call winzip to unzip file. My problem is I want it to show error if it get error such as the file that it try to open is not .zip. This is my code : procID = Shell("C:\Program Files\Winzip\Winzip32.exe -min - e -o -s c:\Temp\Myfile.Zip c:\Temp, , True) At the moment the error message that I got is from winzip itself.
3
11833
by: Mr Utkal Ranjan | last post by:
Hi Friends I want to launch notepad with a specific file on a command click event. So I was using the "Shell" function from VB on a command click event.For ex: Shell "Notepad.exe C:\Program Files\Test.txt",VbNormalFocus But here is the problem in the space of the "Program
2
6674
by: micahstrasser | last post by:
I have been trying for days to send a command to the command prompt through the shell() function in vb.net. For some reason it is not working. Here is the code: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim command As String command = "systeminfo > C:\temp\sysinfo.txt"
9
1522
by: dave m | last post by:
I have a small application that launches an application via the shell function when a listening socket receives data from another PC. This works fine using a WinForms environment. However, I want this listing app to run in the background as a service. When debugging the service, the line - ID = Shell("C:\TestApp.exe", AppWinStyle.NormalFocus) returns a PID value, executes without errors, but the program "TestApp.exe"
4
5977
lwwhite
by: lwwhite | last post by:
I'm working with VB in an Access 2003 database. I have a form, called "EditWindowsFields," that contains a field called "sourcedoc." I am trying to use the Shell function to open the XML file that is specified in the "sourcedoc" field. I've created a button on the form with this as the OnClick event: Shell "C:\Program Files\Adobe\FrameMaker7.1\FrameMaker.exe C:\Sourcedocs\Me.sourcedoc", vbNormalFocus Needless to say, that's not working and...
14
2576
by: JHNielson | last post by:
I posted this in the Access thread, but seeing as how this is a VB problem, I thought this might be the better place I have a code to FTP files to a server, using a script FTP.scr. I need to wait until the FTP completes before proceeding to the next code. So far every process I have written keeps failing, and I'm not sure where I'm going wrong. This is the code as I have it now: Public Sub FTP_Shell(SCR_FILE As String)
0
1356
by: kowndinya | last post by:
hai When i call an external program using shell function, it is running succesfully what i need to do from the external program except the return value is zero hence i can't close that program. if replace the external program name to "notepad", then my programs works fine. What could be the reason? the said external program was done by some third party. only problem is return value. can some one help me in this issue. thanks Raju
3
5370
by: ppuniversal | last post by:
Hi everyone, I am making using Shell() function to run a command line tool from my VB Application. I am using it to archive a folder. So I am using the code : Shell("command line argument as string") where "command line argument as string" is the DOS command for the particular command line zip tool.
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10164
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3723
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.