Force an application to launch in the secondary screen?

J

jameschi

I'm trying to do is to launch Powerpoint Viever 2007 in my secondary screen.
I'm still having issues resizing the pptviewer.exe output when moving the
window to the second monitor. Here's my code so far:


Process view = new Process();
view.EnableRaisingEvents = true;
view.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
view.StartInfo.CreateNoWindow = true;

//Used in development for EXE called from debug folder.
view.StartInfo.FileName = @"C:\Program Files (x86)\Microsoft
Office\Office12\pptview.exe";
view.StartInfo.Arguments = "/s /n" + slideNumber + "\"" +
fileName + "\"";
view.StartInfo.UseShellExecute = false;
view.Start();
view.WaitForInputIdle();

// Get the dimensions for the second monitor
Rectangle secondMonitor = Screen.AllScreens[1].WorkingArea;
SetWindowPos(view.MainWindowHandle, (IntPtr)HWND_TOP,
secondMonitor.Left, secondMonitor.Top, secondMonitor.Width,
secondMonitor.Height, 0);

The code works and puts the viewer in the second screen, however, the
problem I'm running into is the PP viewer sets the size to the main window
(monitor's) dimensions. When the resolution is the same for both monitors, it
works fine, but if they are different, there is clipping. Is there a way to
set the output for pptview.exe to the size of the second monitor?

Any help appreciated!
James
 
S

Sergio T

Hi

I'm trying to do the same thing and I can not.
I used your code but it does'nt work, I have a nootebook and a crt attached to the nootebook, but the ppt file always is showed on the notebook and never is redirect to the crt, Did you solve this problem????

this is my vb.net code
api declaration on the form
Private Declare Function SetWindowPos Lib "user32.dll" Alias "SetWindowPos" (ByVal hWnd As IntPtr, ByVal hWndIntertAfter As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal uFlags As Integer) As Boolean
Private Shared HWND_TOP As IntPtr = IntPtr.Zero


the function

Dim view As New Process()
view.EnableRaisingEvents = True
view.StartInfo.WindowStyle = ProcessWindowStyle.Maximized
view.StartInfo.CreateNoWindow = True
Dim oVarFile As New clsVariable(clsVariable._PPV2007)
If IO.File.Exists(oVarFile.Datos.Valor) Then
view.StartInfo.FileName = oVarFile.Datos.Valor.Trim
view.StartInfo.Arguments = " /S" + Chr(34) + Path + Chr(34)
view.StartInfo.UseShellExecute = False

Dim secondMonitor As Rectangle = Screen.AllScreens(1).WorkingArea
view.StartInfo.CreateNoWindow = FormWindowState.Maximized
view.Start()
view.WaitForInputIdle()

SetWindowPos(view.MainWindowHandle, HWND_TOP, secondMonitor.Left, secondMonitor.Top, secondMonitor.Width, secondMonitor.Height, 0)





While Not view.HasExited

End While
' Get the dimensions for the second monitor
End If
I really appreciate any help
bye
I'm trying to do is to launch Powerpoint Viever 2007 in my secondary screen.
I'm still having issues resizing the pptviewer.exe output when moving the
window to the second monitor. Here's my code so far:


Process view = new Process();
view.EnableRaisingEvents = true;
view.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
view.StartInfo.CreateNoWindow = true;

//Used in development for EXE called from debug folder.
view.StartInfo.FileName = @"C:\Program Files (x86)\Microsoft
Office\Office12\pptview.exe";
view.StartInfo.Arguments = "/s /n" + slideNumber + "\"" +
fileName + "\"";
view.StartInfo.UseShellExecute = false;
view.Start();
view.WaitForInputIdle();

// Get the dimensions for the second monitor
Rectangle secondMonitor = Screen.AllScreens[1].WorkingArea;
SetWindowPos(view.MainWindowHandle, (IntPtr)HWND_TOP,
secondMonitor.Left, secondMonitor.Top, secondMonitor.Width,
secondMonitor.Height, 0);

The code works and puts the viewer in the second screen, however, the
problem I'm running into is the PP viewer sets the size to the main window
(monitor's) dimensions. When the resolution is the same for both monitors, it
works fine, but if they are different, there is clipping. Is there a way to
set the output for pptview.exe to the size of the second monitor?

Any help appreciated!
James

Submitted via EggHeadCafe - Software Developer Portal of Choice
SharePoint WorkFlow Basics
http://www.eggheadcafe.com/tutorial...-356f75d9fca9/sharepoint-workflow-basics.aspx
 
Top