FindWindow() finds top level windows.
What do you know about the window you seek? If you only know the
title/caption an exhaustive search can be accomplished by enumerating all
the top level windows with EnumWindows() and for each one that you find
enumerating its children with EnumChildWindows().
That is not to say that that is a good method, only that it will work. If
you post some more details someone may offer better advice.
Regards,
Will
I'm not up on html but here is the source for the tiny html and a test cpp
program.
//
// save this as page.htm locally.
/*
<HTML>
<HEAD>
<TITLE>FakePage</Title>
</HEAD>
<frameset rows="100%,*" >
<frame src="http://uk.yahoo.com" scrolling="auto">
</frameset>
</HTML>
*/
///////////////////////////////////////////////
// Findpage.cpp
// Try to find the page inside a browser frame
#include <windows.h>
#include <winbase.h>
BOOL CALLBACK EnumWindowsProc(HWND hwnd,LPARAM lParam);
BOOL CALLBACK EnumChildWindowsProc(HWND hwnd,LPARAM lParam);
#define PAGETITLE "Yahoo! UK & Ireland - Microsoft Internet Explorer"
int windowcount=0;
int PASCAL WinMain(HINSTANCE hCurInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
HWND w;
MessageBox(NULL,"Try to Find Yahoo window first","USING
FindWindow",MB_OK);
if ( (w=FindWindow(NULL,PAGETITLE)) != NULL)
MessageBox(NULL,PAGETITLE,"Found Window using findwindow - trying
enumwindows",MB_OK);
else
MessageBox(NULL,"Yahoo window not found - trying enumwindows","No
Luck",MB_OK);
EnumWindows(EnumWindowsProc,1L);
MessageBox(NULL,"OK","Finished",MB_OK);
}
BOOL CALLBACK EnumWindowsProc(HWND hwnd,LPARAM lParam )
{
char title[128];
memset(title,0,128);
GetWindowText(hwnd,title,128);
if ( strstr(title,"Yahoo") != NULL )
MessageBox(NULL,title,"Found Window",MB_OK);
EnumChildWindows(hwnd,EnumChildWindowsProc,1L);
return true;
}
BOOL CALLBACK EnumChildWindowsProc(HWND hwnd,LPARAM lParam )
{
char title[128];
memset(title,0,128);
GetWindowText(hwnd,title,128);
if ( strstr(title,"Yahoo") != NULL )
MessageBox(NULL,title,"Found ChildWindow",MB_OK);
return true;
}
"William DePalo [MVP]" <depalow...@compuserve.com> wrote in message
news:ud36frB5AHA.1272@tkmsftngp07...
"William DePalo [MVP]" <depalow...@compuserve.com> wrote in message news:#uITP2H5AHA.2052@tkmsftngp05..."Bob Kelly" <b...@zunzeecoll.ac.uk> wrote in message
news:#QhtvVD5AHA.2016@tkmsftngp05...
That should get you started if you own the page that frames the documents.
If you don't you'll have to figure out how to get code to run in the
browser.
Sure if you knew the virtual address in the browser where the URL was
stored. :-)
Seriously, if you try to get the data without some level of cooperation from
the browser I don't think your solution will be robust or successful.
An option I didn't mention in my last post is the old SPYGLASS DDE
intreface. It has a "URL echo" function which supposedly sends notifications
about navigation to interested parties. Check out the knowledge base article
Q160957 on the MSDN-CD or at http://msdn.microsoft.com
Regards,
Will