(I use visual studio .net 2005 and c#)
If I use this code for notepad that work fine :
Expand|Select|Wrap|Line Numbers
- Process p = new Process();
- p.StartInfo.FileName = "c:\\windows\\notepad.exe";
- //p.StartInfo.FileName = "c:\\windows\\system32\\RunDll32.exe";
- //p.StartInfo.Arguments = " shell32.dll,Control_RunDLL wscui.cpl";
- p.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
- p.Start();
- p.WaitForInputIdle(2000);
- WinAPI.SetWindowPos(p.MainWindowHandle, WinAPI.HWND_TOP, 0, 0, 600, 600, WinAPI.SWP_SHOWWINDOW);
RunDll32.exe shell32.dll,Control_RunDLL wscui.cpl
by default this window is centered with a default size. I can't resize it.
I use this :
Expand|Select|Wrap|Line Numbers
- WinAPI.STARTUPINFO si = new WinAPI.STARTUPINFO();
- WinAPI.PROCESS_INFORMATION pi = new WinAPI.PROCESS_INFORMATION();
- //si.cb = (uint)Marshal.SizeOf(si);
- si.dwX = 0;
- si.dwY = 0;
- si.dwXSize = 500;
- si.dwYSize = 500;
- si.dwFlags = (uint)(WinAPI.STARTF.STARTF_USEPOSITION) | (uint)WinAPI.STARTF.STARTF_USESIZE;
- WinAPI.CreateProcess("c:\\windows\\system32\\rundll32.exe", " shell32.dll,Control_RunDLL wscui.cpl", IntPtr.Zero, IntPtr.Zero, false, 0, IntPtr.Zero, null, ref si, out pi);
- WinAPI.WaitForInputIdle((int)pi.dwThreadId, int.MaxValue);
- WinAPI.EnumThreadWindows((int)pi.dwThreadId, 0, 0);
- WinAPI.MoveWindow((IntPtr)pi.dwThreadId, 0, 0, 400, 400, true);
How can I do this with this specific window?
Thanks in advance!