How do I launch, say, Microsoft Word from within a C# Win app? Word should
launch exterior to my app, of course. Is it easy to set size and position
of where Word window will be placed?
Thanks,
Ron 6 5200
Process.Start() will do the trick. There is a "WindowStyl e" enum that
lets you control the initial window state somewhat:
Process p = new Process();
p.StartInfo.Fil eName = @"C:\Program Files\Microsoft
Office\Office\w inword.exe";
p.StartInfo.Win dowStyle = ProcessWindowSt yle.Maximized;
p.Start();
Ronald S. Cook wrote: How do I launch, say, Microsoft Word from within a C# Win app? Word should launch exterior to my app, of course. Is it easy to set size and position of where Word window will be placed?
Thanks, Ron
This was exactly what I needed John.. thanks.
Any chance you can tell me how to control the X, Y position of where it
appears on the screen (and size of window)?
Thanks,
Ron
"John Duval" <Jo********@gma il.com> wrote in message
news:11******** **************@ d56g2000cwd.goo glegroups.com.. . Process.Start() will do the trick. There is a "WindowStyl e" enum that lets you control the initial window state somewhat:
Process p = new Process(); p.StartInfo.Fil eName = @"C:\Program Files\Microsoft Office\Office\w inword.exe"; p.StartInfo.Win dowStyle = ProcessWindowSt yle.Maximized; p.Start();
Ronald S. Cook wrote: How do I launch, say, Microsoft Word from within a C# Win app? Word should launch exterior to my app, of course. Is it easy to set size and position of where Word window will be placed?
Thanks, Ron
"Ronald S. Cook" <rc***@westinis .com> wrote in message
news:ub******** ******@TK2MSFTN GP02.phx.gbl... This was exactly what I needed John.. thanks.
Any chance you can tell me how to control the X, Y position of where it appears on the screen (and size of window)?
You might need P/Invoke... although I don't see a managed version, the
STARTUPINFO structure used by Win32 CreateProcess has
dwX
If dwFlags specifies STARTF_USEPOSIT ION, this member is the x offset of the
upper left corner of a window if a new window is created, in pixels.
Otherwise, this member is ignored.
The offset is from the upper left corner of the screen. For GUI processes,
the specified position is used the first time the new process calls
CreateWindow to create an overlapped window if the x parameter of
CreateWindow is CW_USEDEFAULT.
dwY
If dwFlags specifies STARTF_USEPOSIT ION, this member is the y offset of the
upper left corner of a window if a new window is created, in pixels.
Otherwise, this member is ignored.
The offset is from the upper left corner of the screen. For GUI processes,
the specified position is used the first time the new process calls
CreateWindow to create an overlapped window if the y parameter of
CreateWindow is CW_USEDEFAULT.
dwXSize
If dwFlags specifies STARTF_USESIZE, this member is the width of the window
if a new window is created, in pixels. Otherwise, this member is ignored.
For GUI processes, this is used only the first time the new process calls
CreateWindow to create an overlapped window if the nWidth parameter of
CreateWindow is CW_USEDEFAULT.
dwYSize
If dwFlags specifies STARTF_USESIZE, this member is the height of the window
if a new window is created, in pixels. Otherwise, this member is ignored.
For GUI processes, this is used only the first time the new process calls
CreateWindow to create an overlapped window if the nHeight parameter of
CreateWindow is CW_USEDEFAULT. Thanks, Ron "John Duval" <Jo********@gma il.com> wrote in message news:11******** **************@ d56g2000cwd.goo glegroups.com.. . Process.Start() will do the trick. There is a "WindowStyl e" enum that lets you control the initial window state somewhat:
Process p = new Process(); p.StartInfo.Fil eName = @"C:\Program Files\Microsoft Office\Office\w inword.exe"; p.StartInfo.Win dowStyle = ProcessWindowSt yle.Maximized; p.Start();
Ronald S. Cook wrote: How do I launch, say, Microsoft Word from within a C# Win app? Word should launch exterior to my app, of course. Is it easy to set size and position of where Word window will be placed?
Thanks, Ron
"Ronald S. Cook" <rc***@westinis .com> wrote in message
news:ub******** ******@TK2MSFTN GP02.phx.gbl... This was exactly what I needed John.. thanks.
Any chance you can tell me how to control the X, Y position of where it appears on the screen (and size of window)?
Or use Process.WaitFor InputIdle, Process.MainWin dowHandle, and
SetWindowPos... might be necessary for apps that don't respect their startup
parameters. Thanks, Ron "John Duval" <Jo********@gma il.com> wrote in message news:11******** **************@ d56g2000cwd.goo glegroups.com.. . Process.Start() will do the trick. There is a "WindowStyl e" enum that lets you control the initial window state somewhat:
Process p = new Process(); p.StartInfo.Fil eName = @"C:\Program Files\Microsoft Office\Office\w inword.exe"; p.StartInfo.Win dowStyle = ProcessWindowSt yle.Maximized; p.Start();
Ronald S. Cook wrote: How do I launch, say, Microsoft Word from within a C# Win app? Word should launch exterior to my app, of course. Is it easy to set size and position of where Word window will be placed?
Thanks, Ron
Ben,
Could you show me at all what that code would look like? I would greatly
appreciate it.
Thanks,
Ron
"Ben Voigt" <rb*@nospam.nos pam> wrote in message
news:OW******** ******@TK2MSFTN GP03.phx.gbl... "Ronald S. Cook" <rc***@westinis .com> wrote in message news:ub******** ******@TK2MSFTN GP02.phx.gbl... This was exactly what I needed John.. thanks.
Any chance you can tell me how to control the X, Y position of where it appears on the screen (and size of window)?
Or use Process.WaitFor InputIdle, Process.MainWin dowHandle, and SetWindowPos... might be necessary for apps that don't respect their startup parameters.
Thanks, Ron "John Duval" <Jo********@gma il.com> wrote in message news:11******** **************@ d56g2000cwd.goo glegroups.com.. . Process.Start() will do the trick. There is a "WindowStyl e" enum that lets you control the initial window state somewhat:
Process p = new Process(); p.StartInfo.Fil eName = @"C:\Program Files\Microsoft Office\Office\w inword.exe"; p.StartInfo.Win dowStyle = ProcessWindowSt yle.Maximized; p.Start();
Ronald S. Cook wrote: How do I launch, say, Microsoft Word from within a C# Win app? Word should launch exterior to my app, of course. Is it easy to set size and position of where Word window will be placed?
Thanks, Ron
Hi Ronald,
You might want to look at SetWindowPos. Something like this:
[DllImport("user 32.dll")]
static extern bool SetWindowPos(In tPtr hWnd, IntPtr hWndInsertAfter ,
int X, int Y, int cx, int cy, uint uFlags);
private const int HWND_TOP = 0;
[STAThread]
static void Main(string[] args)
{
Process p = new Process();
p.StartInfo.Fil eName = @"C:\Program Files\Microsoft
Office\Office\w inword.exe";
p.StartInfo.Win dowStyle = ProcessWindowSt yle.Normal;
p.Start();
SetWindowPos(p. MainWindowHandl e, (IntPtr)HWND_TO P, 100, 100, 400, 400,
0);
}
Ronald S. Cook wrote: This was exactly what I needed John.. thanks.
Any chance you can tell me how to control the X, Y position of where it appears on the screen (and size of window)?
Thanks, Ron "John Duval" <Jo********@gma il.com> wrote in message news:11******** **************@ d56g2000cwd.goo glegroups.com.. . Process.Start() will do the trick. There is a "WindowStyl e" enum that lets you control the initial window state somewhat:
Process p = new Process(); p.StartInfo.Fil eName = @"C:\Program Files\Microsoft Office\Office\w inword.exe"; p.StartInfo.Win dowStyle = ProcessWindowSt yle.Maximized; p.Start();
Ronald S. Cook wrote: How do I launch, say, Microsoft Word from within a C# Win app? Word should launch exterior to my app, of course. Is it easy to set size and position of where Word window will be placed?
Thanks, Ron This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kendal Goodrich |
last post by:
In the setup project I am trying to create, I am wanting to search to see if
DirectX 8 is installed on the local machine. I figured the best way to
determine would be a registry key search, so I add one. The problem comes
in with the properties for the registry key search. The properties are
RegKey and Value. In viewing the registry...
|
by: scott |
last post by:
From an asp page, i'm trying to auto-open a pop-up page if something exists.
I can do this within access via vba using below code.
Anyone know how I could modify the below js to auto-lauch from asp?
sPage = "javascript:
resizeTo(478,500);moveTo(130,150);document.location.href='http://myserver/myweb/mypopup.asp"
sApp = "c:\Program...
|
by: GrantS |
last post by:
Hi
I am trying to use ShellExecute to launch an application to display a
certain file.
The variation on the theme is that I need to be able to specify the
application to launch and not simply pass the file name (which will
then result in the application associated with the file extension to
launch). I want to prevent the application...
|
by: Joe |
last post by:
I created a CustomAction for this but I don't think I have it in the right
place. I tried both Install and Commit but neither allow it to get to the
final screen.
Are there any examples of this anywhere?
Thanks,
Joe
|
by: psmukilan |
last post by:
Can any one guide me how to launch the installed application immediatley after the Finished screen button clicked. Once the user clicks the finished screen "Close" button, i need to launch the installed application. I tried with installer class. Sample code is given below.I have created a class library and within that an installer class. I tried...
| |
by: sylsau |
last post by:
Hello,
I wrote a JAVA program which uses the JAVA API JDOM 1.0 (of this site
www.jdom.org)
I put the archive jdom.jar in the directory /usr/share/java/jdom.jar
and I added this path in the CLASSPATH variable.
The program runs normally when I launch it in a unix shell.
Now, I want to launch this JAVA program in a PHP program with system()...
|
by: Patrick Dugan |
last post by:
I am trying to launch a vbscript from within vb.net (vs2005)
The script itself requires a parameter of a filename to process.
I have tried:
Dim P As Process = Process.Start("C:\Temp\MyTest.vbs",
"MyFileToProcess.txt")
also
|
by: Ad |
last post by:
It it possible to launch a windows form from within internet explorer?
I need to keep this form on top of anything else, for which i can use
the TopMost property of the form to achieve.
Thanks
|
by: cooltoriz |
last post by:
Hello there,
I am not asking how to impersonate a process within C# windows
application. I already know that, in C# v2.0, you can easily achieve it
using ProcessStartInfo. You can run a process or call external program
as of different user.
The problem of that design is that the mother application is still
running as current user. I know...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |