[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!
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)
Re: [HELP CODING] screenshot from a specific program
To detect app startup, use System.Management
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
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