I am running a process in my GUI program that starts ffmpeg in a hidden cmd shell. I need to make it so when i press the STOP button on my GUI it sends a key stroke message to the cmd shell as if i pressed the "q" key which would tell ffmpeg to stop. I can`t use the Process.Kill() command because it messes up the file that ffmpeg is making.
I found some examples of sending messages to other windows made with VB6 :
I get the SendMessage and FindWindow is not declared error in my VB 2008 program. It looks more like C++ to me but, can someone tell me why I get this error or can someone show an example of how to send a message to a hidden cmd shell in VB 2008 ?
I can get as far as getting the handle of the process but i cant find what i need to send the message.
This is my Stop button code :
I found some examples of sending messages to other windows made with VB6 :
Code:
Dim lNotepadHwnd As Long
Dim lNotepadEdit As Long
Dim sMsg As String = "q"
lNotepadHwnd = FindWindow("Notepad", vbNullString)
lNotepadEdit = FindWindowEx(lNotepadHwnd, 0&, "Edit", vbNullString)
SendMessageSTRING(lNotepadEdit, WM_SETTEXT, 256, sMsg)
I can get as far as getting the handle of the process but i cant find what i need to send the message.
This is my Stop button code :
Code:
Private Sub Btn_Stop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Stop.Click
Dim processHandle As Long = Process1.Handle
'What type of command do i need hear to send "q" key to hidden cmd shell ?
Btn_Stop.Enabled = False
Btn_Record.Enabled = True
UD_Minutes.Enabled = True
End Sub
Comment