I try to use sendkeys, problem is focus. First i parent a external .exe in a panel. All works fine :-).
VB.NET
PrivateSub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
proc = Process.Start("C:\Program Files\DOSBox-0.72\dosbox.exe", "-noconsole")
proc.WaitForInputIdle()
ForEach proc As Process In Process.GetProcesses()
If proc.MainWindowTitle.StartsWith("DOSBox") Then
handle = proc.MainWindowHandle
EndIfNext
SetParent(proc.MainWindowHandle, Me.Panel1.Handle)
SendMessage(proc.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0)
EndSub
Only problem is senkeys to that .exe.
VB.NET
PublicFunction whichbuttonpushed(ByVal _sender AsString) AsString
SetActiveWindow(Me.Panel1.Handle) 'Set focus Active windowSelectCase _sender
Case"btna"
keybd_event(VK_A, 0, 0, 0) 'send a key
keybd_event(VK_A, 0, KEYEVENTF_KEYUP, 0) 'release a key
My.Computer.Keyboard.SendKeys("22", True)
EndSelectEndFunction
Here i have a focus problem. I'm using vb.net2008, learning from books add home just for fun.
Answers
Know the answer? Post it. Somebody with the same question will find it here.
Answers
Know the answer? Post it. Somebody with the same question will find it here.