Results 1 to 5 of 5

Thread: [HELP CODING] screenshot from a specific program

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2017
    Posts
    96

    Exclamation [HELP CODING] screenshot from a specific program

    Hello friends !!!
    I would like to take a screenshot automatically of a program called "mugen.exe" from my application (it is different .exe) after 60 secondes that mugen.exe was executed or started.

    also, if you knew a code to detect a program launched , i would be wowed to learn it!

    Here is the code to make A Screen Capture Program but not a specific program
    Code:
    
    Dim bounds As Rectangle
    
    Dim screenshot As System.Drawing.Bitmap
    
    Dim graph As Graphics
    
    bounds = Screen.PrimaryScreen.Bounds
    
    screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
    
    graph = Graphics.FromImage(screenshot)
    
    graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
    
    PictureBox1.Image = screenshot



    I would like someone who are more experience than me to modify it to capture the program mugen.exe(sourcepath/MUGEN/MUGEN.exe)
    INTERNET IS a desert i can't stand any more! please give me a hand !
    thank you in advance for your answer!

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: [HELP CODING] screenshot from a specific program

    There’s several things you forgot there... your app. Must bring the exe to the top of the zorder
    You need to get the exe bounds rectangle...
    You’ll need a method for monitoring exe startup (I’ll search for that for you)

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: [HELP CODING] screenshot from a specific program

    To detect app startup, use System.Management

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: [HELP CODING] screenshot from a specific program

    To bring your app to the front...

    Code:
    AppActivate("Your TitleBar text")
    To get the bounds, read this...

    https://social.technet.microsoft.com...n-capture.aspx

    Someone else might be able to help you with the System.Management part

  5. #5
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: [HELP CODING] screenshot from a specific program

    Try this for the startup watcher...

    Code:
    Dim watcher As ManagementEventWatcher
    
    Public Sub Main()
        Dim monitoredProcess = "Notepad.exe"
        Dim query As WqlEventQuery = New WqlEventQuery("__InstanceCreationEvent", new TimeSpan(0, 0, 1), "TargetInstance isa ""Win32_Process"" And TargetInstance.Name = """ & monitoredProcess & """")
    
        watcher = New ManagementEventWatcher()
        watcher.Query = query
    
        'This starts watching asynchronously, triggering EventArrived events every time a new event comes in.
        'You can do synchronous watching via the WaitForNextEvent() method
        watcher.Start()
    
    End Sub
    
    Private Sub Watcher_EventArrived(sender As Object, e As EventArrivedEventArgs) Handles watcher.EventArrived
        'Do stuff with the startup event
    End Sub

Tags for this Thread

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