473,406 Members | 2,620 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,406 software developers and data experts.

Enumerating Explorer shell windows out of memory exception

On certain occasions I get COM exceptions errors when enumerating the
Windows Explorer active windows

Some customers reported the error
System.OutOfMemoryException: Retrieving the COM class factory for
component with CLSID {9BA05972-F6A8-11CF-A442-00A0C90A8F39} failed due
to the following error: 8007000e.

Here's the code I use to retrieve the list of IE windows. Are there
better solutions that prevent the exceptions?

try {
SHDocVw.ShellWindows shell = new ShellWindowsClass();

int ihandle=handle.ToInt32();
foreach (InternetExplorer ie in shell) {

try {
if (ihandle == ie.HWND) {
path=ie.LocationURL;
}
}
catch (System.Runtime.InteropServices.COMException ex) {

}
catch (System.UnauthorizedAccessException ex) {
}
} catch (FileNotFoundException ex) {
}
catch (System.TypeLoadException ex) {
}

Sep 28 '07 #1
4 2820
Hi nagar,

Several points:

1) If you're only retrieving IE windows, you should cast the item to
IWebBrowser2 first before accessing LocationURL.

2) Please note that using ShellWindows to enumerate IE windows is not
reliable, for example, on Vista, you might not be able to enumerate IE
windows running under protected mode.

I noticed you're testing the handle, could you please tell me more about
your objective or requirement here?

How can I reproduce the issue on my side?
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 28 '07 #2
Actually, I want to retrieve the instances of the explorer windows
opened (to get the path of the opened explorer windows).
Is there a reliable way to do that?
I wasn't able to reproduce the problem on my machine but I guess that
the Vista issue could be the cause.
Thanks,
Andrea

On Fri, 28 Sep 2007 08:20:40 GMT, wa****@online.microsoft.com ("Walter
Wang [MSFT]") wrote:
>Hi nagar,

Several points:

1) If you're only retrieving IE windows, you should cast the item to
IWebBrowser2 first before accessing LocationURL.

2) Please note that using ShellWindows to enumerate IE windows is not
reliable, for example, on Vista, you might not be able to enumerate IE
windows running under protected mode.

I noticed you're testing the handle, could you please tell me more about
your objective or requirement here?

How can I reproduce the issue on my side?
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

================================================= =
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================= =

This posting is provided "AS IS" with no warranties, and confers no rights.
Sep 29 '07 #3
<na***@community.nospamwrote in message
news:a3********************************@4ax.com...
Actually, I want to retrieve the instances of the explorer windows
opened (to get the path of the opened explorer windows).
Is there a reliable way to do that?
I wasn't able to reproduce the problem on my machine but I guess that
the Vista issue could be the cause.
Thanks,
Andrea
This shouldn't be an issue on Vista either, as long as you run your code in
the logon session of interactive desktop, running this from a service won't
work on vista.

Willy.

Sep 29 '07 #4
Hi Andrea,

So far I'm only aware that retrieving IE instances via ShellWindows might
not be reliable, not mentioned if there's any issues for explorer windows.
Given the nature of this issue that it's not reprodicuble, I think you
might need to contact our Customer Support and Service for further
troubleshooting. Thanks for your understanding.
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 3 '07 #5

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

Similar topics

9
by: none | last post by:
Hello all, I wrote a shell program a few years ago in VB6 that needs to be modified. The problem I have is this: The SysAdmin uses this shell in place of Explorer, so there is no taskbar. When...
0
by: Tom Dacon | last post by:
"Open .Net Command Window Here" context menu for Windows Explorer: The reg file described below adds a new menu item to Windows Explorer's context menu when you right-click over a folder (or the...
0
by: Brett Mostert | last post by:
Hi, I need to be able to Enumerate through Printer Drivers, ports, printers and so fourth. And even add printers, ports, and drivers and setup printers. Sofar i can do all of the following...
1
by: Steve Randall | last post by:
I am building a utility application that uses much of the same functionality as already exists in the Windows Explorer. It would therefore make sense to use (if possible) the Windows Explorer as the...
4
by: Brett Mostert | last post by:
Hi, I need to be able to Enumerate through Printer Drivers, ports, printers and so fourth. And even add printers, ports, and drivers and setup printers. Sofar i can do all of the following...
1
by: Patrick Pirtle | last post by:
Well, I've spent the last 5 hours with Google, trying to find the answer to this question--I have an app that needs to perform its operations on a folder (or folder background) selected in Windows...
0
by: wifetalks | last post by:
I'm enumerating the computers in the domain to a listview control on my form, but how do I include the comments. Like what you would see in Windows Explorer when you browse the domain. On our...
5
by: John | last post by:
I get a 'divide by zero' exception when I scroll in a subdirectory of 'My Pictures'. This subdirectory is full of .ico, .bmp, .png files that I use for button images in my Windows Forms projects. ...
1
by: jmi0 | last post by:
I want to create a custom user control to be used in a web page (by object tag) as an assembly. The user control needs to have a web browser control in it. Having tried with the managed...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
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...
0
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...
0
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...

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.