473,394 Members | 1,875 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,394 software developers and data experts.

Odd result using EnumWindows

I've written a callback function for use with EnumWindow that is intended to
return the URL of all open IE windows. The code seems to do almost exactly
what I want, but fails at the final step when it tries to retrieve the text
of the address bar using the Win32 API GetWindowText. It returns an empty
string instead of the URL. Has anyone tried this? The code is pretty
straightforward, but I don't see what wrong:

private bool ieCheck(int hWnd, int lParam)
{
StringBuilder text = new StringBuilder(256);
if (GetClassName(hWnd, text, 256) == 0)
return true;
if (text.ToString() != "IEFrame")
return true;
int ieHandle = FindWindowEx(hWnd, 0, "WorkerW", null);
if ((int)ieHandle > 0)
{
ieHandle = FindWindowEx(ieHandle, 0, "ReBarWindow32", null);
if ((int)ieHandle > 0)
{
ieHandle = FindWindowEx(ieHandle, 0, "ComboBoxEx32", null);
if ((int)ieHandle > 0)
{
GetWindowText(hWnd, text, 256);
output.Add(text.ToString());
}
}
}
return true;
}
Nov 16 '05 #1
0 1305

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

Similar topics

5
by: Sean Dudley | last post by:
I am currently enumerating windows via the EnumWindows API. I noticed that for some reason the very first time I call my enumwindows routine (inside or outside of a thread) it seems to be very...
11
by: Wayne | last post by:
I have some code written in delphi that uses EnumWindows, I would like to begin to translate this code to C#. Is there a built in EnumWindows call in Csharp? or do I have to import the API and use...
4
by: Geoff | last post by:
I need to reproduce functionality from a VB6 application in VB .Net. In the VB6 app, I use FindWindow, EnumWindows and other related functions. Is there a .Net NameSpace that replaces these...
2
by: Husam | last post by:
Hi EveryBody: I have the following code which just helpfull with Notepad: Code: <DllImport("user32", CharSet:=CharSet.Auto, SetLastError:=True)> _ Public Shared Function FindWindow(ByVal...
2
by: ken | last post by:
i'm trying to figure out the complexity of writing a Windows C++ app that will automatically read a Poker window and then be able to make odds estimates based on that. there are applications out...
0
by: Sasie7679 | last post by:
Dear All, We have a requirement to open any document with a specific application and display it within a OCX control (Example - word, excel, adobe reader, MSPaint, Photoshop etc). We are using...
1
by: =?Utf-8?B?VHJlY2l1cw==?= | last post by:
Hello, Newsgroupians: I've a question regarding the Win32 function EnumWindows. First, the prototype for EnumWindows is as follows... BOOL EnumWindows(WNDENUMPROC lpEnumFunc, LPARAM lParam) ...
4
by: Steve | last post by:
Hi guys, You know how annoying it is when Visual Studio keeps asking you for a username and password to access TFS? I figured it would be easy to write a little System Tray utility that could...
3
by: korean_dave | last post by:
How do I use the win32com API to manipulate IE windows ALREADY open? ie = Dispatch("InternetExplorer.Application") opens a new window. But I'd like to be able to find, of windows already open,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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
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
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
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...

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.