Results 1 to 9 of 9

Thread: [RESOLVED] Threads, Processes getting locked

Threaded View

  1. #1

    Thread Starter
    Lively Member SpagettiProg's Avatar
    Join Date
    Dec 2004
    Location
    Miami, Florida
    Posts
    82

    Resolved [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:
    1. Imports System.ServiceProcess
    2. Imports System.Threading
    3. Imports System.IO
    4.  
    5.  
    6.  
    7.  
    8. Public Class Service1
    9.     Inherits System.ServiceProcess.ServiceBase
    10.  
    11.     Dim start As Diagnostics.Process
    12.     Dim thread1 As Thread
    13.     Dim mainPath As String
    14.  
    15.  
    16.     Protected Overrides Sub OnStart(ByVal args() As String)
    17.        
    18.         thread()
    19.  
    20.     End Sub
    21.  
    22.  
    23.  
    24.     Public Sub thread()
    25.  
    26.         thread1 = New Thread(AddressOf RunMyapp)
    27.         thread1.Start() 'starts the thread
    28.  
    29.     End Sub
    30.  
    31.  
    32.     Public Sub RunMyapp()
    33.  
    34.    
    35.         mainPath = "C:\Program Files\Windows NT\Accessories\wordpad.exe"
    36.         start = New Diagnostics.Process
    37.         start.StartInfo.WindowStyle = ProcessWindowStyle.Maximized
    38.         start.Start(mainPath)
    39.  
    40.  
    41.     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
  •  



Click Here to Expand Forum to Full Width