473,803 Members | 4,391 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to create an array of a certain type

I am writing a programme that when run will list the current internet
explorer windows open, and allow the user to choose which one they
would like to work with. At the moment I have managed to get as far as
finding open windows, and detecting which ones are internet explorer
windows, but I do not know how to store the ones that are internet
explorer windows and reference them later.

My idea was that I could create an array of type ShellWindows and store
those windows that matched the following check: -

Int32 iLocation = ie.FullName.Ind exOf("iexplore" );
if (iLocation >= 0)

The check works ok, but i don't know how to store the windows that pass
this check into an array for future use.

Any assistance would be useful.

Gary.

using System;
using System.Collecti ons.Generic;
using System.Componen tModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows. Forms;
using SHDocVw;

namespace InternetExplore rInterface
{
public partial class Form1 : Form
{
public Form1()
{
InitializeCompo nent();
}

private void Form1_Load(obje ct sender, EventArgs e)
{
foreach (InternetExplor er ie in new ShellWindows())
{

Int32 iLocation = ie.FullName.Ind exOf("iexplore" );
if (iLocation >= 0)

{
MessageBox.Show (ie.LocationNam e);
MessageBox.Show (ie.LocationURL );
}
}

}
}
}

Nov 28 '06 #1
2 1343
Try this:
ArrayList ar = new ArrayList();
if (iLocation >= 0) ar.Add(ie);

Mihaly

"ga********@myw ay.com" wrote:
I am writing a programme that when run will list the current internet
explorer windows open, and allow the user to choose which one they
would like to work with. At the moment I have managed to get as far as
finding open windows, and detecting which ones are internet explorer
windows, but I do not know how to store the ones that are internet
explorer windows and reference them later.

My idea was that I could create an array of type ShellWindows and store
those windows that matched the following check: -

Int32 iLocation = ie.FullName.Ind exOf("iexplore" );
if (iLocation >= 0)

The check works ok, but i don't know how to store the windows that pass
this check into an array for future use.

Any assistance would be useful.

Gary.

using System;
using System.Collecti ons.Generic;
using System.Componen tModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows. Forms;
using SHDocVw;

namespace InternetExplore rInterface
{
public partial class Form1 : Form
{
public Form1()
{
InitializeCompo nent();
}

private void Form1_Load(obje ct sender, EventArgs e)
{
foreach (InternetExplor er ie in new ShellWindows())
{

Int32 iLocation = ie.FullName.Ind exOf("iexplore" );
if (iLocation >= 0)

{
MessageBox.Show (ie.LocationNam e);
MessageBox.Show (ie.LocationURL );
}
}

}
}
}

Nov 28 '06 #2
I am writing a programme that when run will list the current internet
explorer windows open, and allow the user to choose which one they
would like to work with. At the moment I have managed to get as far as
finding open windows, and detecting which ones are internet explorer
windows, but I do not know how to store the ones that are internet
explorer windows and reference them later.

My idea was that I could create an array of type ShellWindows and
store those windows that matched the following check: -

Int32 iLocation = ie.FullName.Ind exOf("iexplore" );
if (iLocation >= 0)
The check works ok, but i don't know how to store the windows that
pass this check into an array for future use.

Any assistance would be useful.
Try this:

using System;
using System.Collecti ons.Generic;
using System.Componen tModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows. Forms;
using SHDocVw;

namespace InternetExplore rInterface
{
public partial class Form1 : Form
{
public Form1()
{
InitializeCompo nent();
}

private List<InternetEx plorerieList = new List<InternetEx plorer>();

private void Form1_Load(obje ct sender, EventArgs e)
{
foreach (InternetExplor er ie in new ShellWindows())
{
Int32 iLocation = ie.FullName.Ind exOf("iexplore" );
if (iLocation >= 0)
ieList.Add(ie);
}
}
}
}
Best Regards,
Dustin Campbell
Developer Express Inc.
Nov 28 '06 #3

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

Similar topics

38
5241
by: VK | last post by:
Hello, In my object I have getDirectory() method which returns 2-dimentional array (or an imitation of 2-dimentional array using two JavaScript objects with auto-handled length property - please let's us do not go into an "each dot over i" clarification discussion now - however you want to call - you call it ;-) array contains records of all files in the current dir. array contains records of all subs in the current dir
7
8875
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I want my users to be able to select a report, click on a command button on a form, which will then automatically create the report as a pdf file and save it to the user's machine. I am using Adobe Acrobat (5.0 I think) and have Adobe Distiller as a
5
3439
by: Richard Delorme | last post by:
The n869 draft says: J.2 Undefined behavior The behavior is undefined in the following circumstances: -- An array subscript is out of range, even if an object is apparently accessible with the given subscript (as in the lvalue expression a given the declaration
30
3225
by: James Daughtry | last post by:
char array; scanf("%19s", &array); I know this is wrong because it's a type mismatch, where scanf expects a pointer to char and gets a pointer to an array of 20 char. I know that question 6.12 of the C FAQ says that it's wrong for that very reason. What I don't know is where the standard tells me conclusively that it's wrong. What I also don't know is somewhere that this type mismatch will break in practice.
30
3361
by: questions? | last post by:
say I have a structure which have an array inside. e.g. struct random_struct{ char name; int month; } if the array is not intialized by me, in a sense after I allocated a
2
1328
by: nospam | last post by:
I have an application that processes 30 kinds of strings of that fit in an array. By processing, I mean -check the value of certain characters or substrings to be within contant bounds or a member of a list -check the value of certain characters or substrings to be within bounds defined by other characters or substrings -call a series of functions based on value of certain substrings.
23
7423
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these in an array. The application compiles but aborts without giving me any useful information. What I suspect is happening is infinite recursion. Each Directory object creates an array of Subdirectories each of which has an array of...
15
636
by: Jess | last post by:
Hi, If I have an array of pointer like: char* a = {"a","b","c"}; then it works fine. Since "a" is effectively "a" char**, I tried the following, which doesn't work: char** a = {"a","b","c"};
1
1774
by: =?ISO-8859-1?Q?Norbert_P=FCrringer?= | last post by:
Hello, does anyone know, if it is possible (via reflection?) to instantiate a multidimensional array of a certain type, which is first known at run time? e.g. at runtime I have to create an array of type string. The type string is given by a variable of type Type. So the input parameter are Type, Cols and Rows.
0
9699
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
9562
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,...
1
10289
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9119
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...
1
7600
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5496
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4274
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
3795
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.