473,786 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting main window from launched process

Hi All,

I am launching a IE using following code.
=============== =============== =============== =============== ===========
m_IeProcess = new Process();
m_IeProcess.Sta rtInfo.WindowSt yle = ProcessWindowSt yle.Minimized;
m_IeProcess = Process.Start(" IExplore.exe"," www.ABC.com");
=============== =============== =============== =============== ===========

how do i get refrence to the InternetExplore r from the process.

only way i could do it is by iterating over the all windows as follows

=============== =============== =============== =============== ===

m_Windows = new ShellWindows();
foreach(Interne tExplorer ie in m_Windows)
{
if(ie != null && (IntPtr)ie.HWND ==
m_IeProcess.Mai nWindowHandle)
{
return ie;
}
}
=============== =============== =============== =============== ===========

Qustion :
is there a way to get refrence to the internet explorer without using
shell window.

Process class has properties that return Mainwindow handle and caption
etc...but i do not see anything that returns the reference to the main
window itself.

I need the refrence to IE because i want to iterate through the window
object model.
I will be running this code as windows service and shell window does
not work in windows service that why i am looking at other ways to do
this.

SO is there a way to get the refrence to IE from the lauched process
or may be using a windows API that will work in windows service as
well?

Thanks
Siddharth
Dec 7 '07 #1
2 1916
On Dec 7, 2:51 pm, siddharthkh...@ hotmail.com wrote:
Hi All,

I am launching a IE using following code.
=============== =============== =============== =============== ===========
m_IeProcess = new Process();
m_IeProcess.Sta rtInfo.WindowSt yle = ProcessWindowSt yle.Minimized;
m_IeProcess = Process.Start(" IExplore.exe"," www.ABC.com");
=============== =============== =============== =============== ===========

how do i get refrence to the InternetExplore r from the process.

only way i could do it is by iterating over the all windows as follows

=============== =============== =============== =============== ===

m_Windows = new ShellWindows();
foreach(Interne tExplorer ie in m_Windows)
{
if(ie != null && (IntPtr)ie.HWND ==
m_IeProcess.Mai nWindowHandle)
{
return ie;
}
}

=============== =============== =============== =============== ===========

Qustion :
is there a way to get refrence to the internet explorer without using
shell window.

Process class has properties that return Mainwindow handle and caption
etc...but i do not see anything that returns the reference to the main
window itself.

I need the refrence to IE because i want to iterate through the window
object model.
I will be running this code as windows service and shell window does
not work in windows service that why i am looking at other ways to do
this.

SO is there a way to get the refrence to IE from the lauched process
or may be using a windows API that will work in windows service as
well?

Thanks
Siddharth
Well, your not going to get a .net reference from the process
class... All your gong to get is the MainWindow handle (you could
probably wrap it in an instance of NativeWindow). What exactly are
you trying to accomplish? I have a feeling there is a much better
way...

--
Tom Shelton
Dec 8 '07 #2
Use CLSID_INTERNETE XPLORER to create a com object. You can all its methods
using late binding, or create an early binding class.
--
Sheng Jiang
Microsoft MVP in VC++
<si************ @hotmail.comwro te in message
news:22******** *************** ***********@d21 g2000prf.google groups.com...
Hi All,

I am launching a IE using following code.
=============== =============== =============== =============== ===========
m_IeProcess = new Process();
m_IeProcess.Sta rtInfo.WindowSt yle = ProcessWindowSt yle.Minimized;
m_IeProcess = Process.Start(" IExplore.exe"," www.ABC.com");
=============== =============== =============== =============== ===========

how do i get refrence to the InternetExplore r from the process.

only way i could do it is by iterating over the all windows as follows

=============== =============== =============== =============== ===

m_Windows = new ShellWindows();
foreach(Interne tExplorer ie in m_Windows)
{
if(ie != null && (IntPtr)ie.HWND ==
m_IeProcess.Mai nWindowHandle)
{
return ie;
}
}
=============== =============== =============== =============== ===========

Qustion :
is there a way to get refrence to the internet explorer without using
shell window.

Process class has properties that return Mainwindow handle and caption
etc...but i do not see anything that returns the reference to the main
window itself.

I need the refrence to IE because i want to iterate through the window
object model.
I will be running this code as windows service and shell window does
not work in windows service that why i am looking at other ways to do
this.

SO is there a way to get the refrence to IE from the lauched process
or may be using a windows API that will work in windows service as
well?

Thanks
Siddharth

Dec 8 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
6601
by: BlackHawke | last post by:
Our program, game program Andromeda Online (www.andromedaonline.net) uses two programs- one to play the game, another to patch the game as updates come out. Players actually launch the updater which checks for fresh updates, then installs them, then launches the game client. We have begun our beta test, and would like to have the client open with a console window so that players can see exceptions that are thrown. How to do this seems to...
10
14738
by: Scott | last post by:
I'm new to ASP, but I've been programming in VB for several years, and I'm having a few issues with this ASP enhancement I'm working on. I've found ASP to be a lot different than what I'm use to in VB. I've created an ASP interface where a user can select an email group that populates a listbox with those email addresses. If a user sees an email in that list that they do not want then they can remove it by clinking the Delete button...
11
5081
by: objectref | last post by:
Hi to all, is there a way to get the window handle of the main window of an application or process ? For example, if someone opens Microsoft Word, he gets a window so he/she can write text. Spy++ gives that this window is called _Wwg. How we can get a handle to this window assuming that we do not know beforehand the name of the process,
6
38454
by: James Li | last post by:
I need to run multiple .bat files(in specific order, sychronously) from my C# windows app. I also want to hide the DOS command window so that users don't see them. Basically my program lanches .bat file to do some installation, status of the installation will be displayed on the windows app, but don't want the dos window showed. I look at Microsoft.VisualBasic.Interaction.Shell, that Shell out command is asynchronous, right? If it...
1
257
by: tma | last post by:
First, I'm following instructions without truly understanding them, so go easy on me... :) I am exporting a report to .PDF. Below is a code snippet. What I would like is for a new IE instance to be launched with the .pdf instead of the current IE window/aspx page. (My real problem is the window with which I am viewing the pdf does not go back to the page that launched the export but rather the page prior to it!) What do I need to change...
1
3501
by: spamproof2005 | last post by:
I have the following code: Dim BrowserLauncher As New ProcessStartInfo BrowserLauncher.FileName = URL BrowserLauncher.CreateNoWindow = False BrowserLauncher.UseShellExecute = True BrowserLauncher.WindowStyle = ProcessWindowStyle.Maximized Process.Start(BrowserLauncher) Each time I run this, IE does NOT open a new browser window but instead
12
6543
by: Dilip | last post by:
Hi All I have a server based C# console application. This application must hide its console window when its launched out on the field. So I dutifully P/Invoke'd FindWindow/ShowWindow combination to hide the console window at launch time. The application (for legacy reasons) hangs around by waiting on an old- fashioned Console.ReadLine() statement.
2
3345
by: siddharthkhare | last post by:
Hi All, I am launching a IE using following code. ======================================================================= m_IeProcess = new Process(); m_IeProcess.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; m_IeProcess = Process.Start("IExplore.exe","www.ABC.com"); ======================================================================= how do i get refrence to the InternetExplorer from the process.
1
1400
by: KakaICE | last post by:
Hi, I am using Visual Studio 2005 The problem is: The parent.exe launches a child.exe executible. In the child.exe process I want to know the commandline with which parent.exe was originally launched. I am trying to do it as follows in child.exe: GetCurrentProcessId() CreateToolhelp32Snapshot() get the parent process ID of child.exe process
0
9647
marktang
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9492
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10360
Oralloy
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10163
jinu1996
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9960
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4064
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.