473,386 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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.IndexOf("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.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SHDocVw;

namespace InternetExplorerInterface
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
foreach (InternetExplorer ie in new ShellWindows())
{

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

{
MessageBox.Show(ie.LocationName);
MessageBox.Show(ie.LocationURL);
}
}

}
}
}

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

Mihaly

"ga********@myway.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.IndexOf("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.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SHDocVw;

namespace InternetExplorerInterface
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
foreach (InternetExplorer ie in new ShellWindows())
{

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

{
MessageBox.Show(ie.LocationName);
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.IndexOf("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.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SHDocVw;

namespace InternetExplorerInterface
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private List<InternetExplorerieList = new List<InternetExplorer>();

private void Form1_Load(object sender, EventArgs e)
{
foreach (InternetExplorer ie in new ShellWindows())
{
Int32 iLocation = ie.FullName.IndexOf("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
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...
7
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...
5
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 ...
30
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...
30
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
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...
23
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...
15
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 =...
1
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...

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.