Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. [DllImport("user32.dll", SetLastError = true)]
  2. private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
  3.  
  4. [DllImport("user32.dll")]
  5. public static extern IntPtr SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int Y, int cx, int cy, int wFlags);
  6.  
  7. [DllImport("user32.dll")]
  8. public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
  9.  
  10. [DllImport("user32.dll")]
  11. public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
  12.  
  13. Eventlogging = "Модуль Командная строка: инициализация запуска cmd";
  14. ValueCommandLine.StatusRunCmd = true;
  15. ProcessStartInfo Info = new ProcessStartInfo();
  16. Info.Arguments = "cd c:\";
  17. Info.FileName = "cmd.exe";
  18. Process p = new Process();
  19. p.StartInfo = Info;
  20. p.Start();
  21. MainForm.ValueCommandLine.ProcessCmdID = p.Id;
  22. Thread.Sleep(1000);
  23. IntPtr hostHandle = p.MainWindowHandle;
  24. ValueCommandLine.ProcessHandle = p.MainWindowHandle;
  25. SetParent(hostHandle, panel6.Handle);
  26. SetWindowPos(p.MainWindowHandle, 0, panel6.Location.X - 20, panel6.Location.Y - 68, panel6.Size.Width + 20, panel6.Size.Height + 40, 0x0040);
  27.  
  28.  
  29. private void panel6_Resize(object sender, EventArgs e)
  30. {
  31. SetWindowPos(ValueCommandLine.ProcessHandle, 0, panel6.Location.X - 20, panel6.Location.Y - 68, panel6.Size.Width + 20, panel6.Size.Height + 40, 0x0040);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement