|
-
Jun 2nd, 2006, 09:32 AM
#1
Thread Starter
Lively Member
[RESOLVED] Threads, Processes getting locked
Hi Everyone,
I'm writing a service in VB.NET, and it starts up fine, but I have a problem when I stop the service. If I launch an application from my service, when I stop the service, the other application is still running. How can I terminate it.
Note: I tried Posting a WM_CLOSE to wordpad.exe and it did not work.
Here is some code......
VB Code:
Imports System.ServiceProcess
Imports System.Threading
Imports System.IO
Public Class Service1
Inherits System.ServiceProcess.ServiceBase
Dim start As Diagnostics.Process
Dim thread1 As Thread
Dim mainPath As String
Protected Overrides Sub OnStart(ByVal args() As String)
thread()
End Sub
Public Sub thread()
thread1 = New Thread(AddressOf RunMyapp)
thread1.Start() 'starts the thread
End Sub
Public Sub RunMyapp()
mainPath = "C:\Program Files\Windows NT\Accessories\wordpad.exe"
start = New Diagnostics.Process
start.StartInfo.WindowStyle = ProcessWindowStyle.Maximized
start.Start(mainPath)
End Sub
Last edited by SpagettiProg; Jun 5th, 2006 at 09:57 AM.
Reason: Resolved
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
|