CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Threaded View

  1. #3
    Join Date
    May 2013
    Posts
    5

    Unhappy Re: call a module from a form

    Quote Originally Posted by HanneSThEGreaT View Post
    Well, it is a Public sub, so, by definition, you should be able to call and use it from anywhere.

    If you give us a bigger picture of what you're actually trying to achieve, we could advise better.
    I want to put codes in "my application" that can terminate a process/processes when the specified processes is running, I want it active all the time when "my application" is running.

    but then I found this code that more simple than the above codes:

    Code:
    Private Sub TerminateProcess(app_exe As String)
            Dim Process As Object
            For Each Process In GetObject("winmgmts:").ExecQuery("Select Name from Win32_Process Where Name = '" & app_exe & "'")
                    Process.Terminate
            Next
    End Sub
    and put this code in cmdStart:
    Code:
    TerminateProcess ("notepad.exe")
    TerminateProcess ("explorer.exe")
    TerminateProcess ("blablabla.exe")
    my problem now is I don't know how to make cmdStart... (Feeling stupid)
    Last edited by blumoon; June 5th, 2013 at 03:18 AM.

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

Featured