Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void LaunchRPGApp(Application program)
- {
- var processInfo = new ProcessStartInfo("pcsws.exe")
- {
- WindowStyle = ProcessWindowStyle.Normal,
- Arguments = ""C:\Program Files (x86)\IBM\Client Access\Emulator\Private\veflast1.ws"",
- RedirectStandardInput = true,
- UseShellExecute = false,
- };
- var process = Process.Start(processInfo);
- if (process == null) throw new Exception("Error starting process.");
- using (var sr = process.StandardInput)
- {
- sr.Write("f");//does nothing
- sr.Close();
- }
- }
- [DllImport("user32.dll", EntryPoint = "FindWindowEx")]
- public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
- [DllImport("User32.dll")]
- public static extern int SendMessage(IntPtr hWnd, int uMsg, int wParam, string lParam);
- private void SendTextToProcess(Process p, string text)
- {
- const int WM_SETTEXT = 0x000C;
- const int WM_KEYDOWN = 0x0100;
- const int F_KEY = 0x46;
- Thread.Sleep(500);
- var child = FindWindowEx(p.MainWindowHandle, new IntPtr(0), "Edit", null);
- SendMessage(child, WM_KEYDOWN, F_KEY, null);//does nothing
- SendMessage(child, WM_SETTEXT, 0, text);//does nothing
- }
- ProcessStartInfo startInfo = new ProcessStartInfo("pcsws.exe");
- startInfo.WindowStyle = ProcessWindowStyle.Normal;
- startInfo.Arguments = "C:\Program Files (x86)\IBM\Client Access\Emulator\Private\veflast1.ws";
- Process.Start(startInfo);
Add Comment
Please, Sign In to add comment