C++ enumwindow and callback

M

mo A

Hi all,
I would like to send a message to all open Internet Explorer Windows to
change thier title (and later, send a string to a text box in that IE
window --clicked by a user--
i know that EnumWindows This function enumerates all top-level windows
on the screen by passing the handle to each window, in turn, to an
application-defined callback function.
in my app i did the following,


//Global Variable
HWND handleback=0;

BOOL onefunc(HWND);
static BOOL CALLBACK myfunc(HWND Handle,LPARAM lParam)
{
return onefunc(Handle);
}

BOOL onefunc(HWND Handle)
{
char array [256];
//HWND hWndIE;
if (Handle > 0)
{
//its valid
//PostMessage(hWndIE ,WM_KEYDOWN,/(WPARAM)Buffer'A',0);
handleback=Handle;
GetWindowText(handleback,array, 256);
//get the window ttile,
if(strstr(array,"Microsoft Internet Explorer")!=NULL)
{
SetWindowText(handleback,"Mywindow1");
//i also want to send character to a user
//clicked textbox in the IE window
PostMessage(handleback,WM_KEYDOWN,'A',0);

}
return true ;
}
}

//in main
EnumWindows(&myfunc,NULL);
onefunc repeatidly.
how can i implement this? what is wrong with my CALLBACK function?

Regards,
Mo
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top