dim hwnd as long

I am using FindWindow function to find whether Internet Explorer is open or not .

hwnd = FindWindow(vbnullstring,"Google - Microsoft Internet Explorer")

the problem is it easily find most of the windows , but in few cases for example if i type something in google search and if i navigate to any of the resulting page then if i call the hwnd function its unable to find it .

My Question Is i cannot go on giving different string like

"Google - Microsoft Internet Explorer"
"search engine - Google Search - Microsoft Internet Explorer"

so is there a way to to give something which finds all opened IE whatever the toolbar text it has .

i assume your task is to find whether an instance of IE is open or not.
In that case you can loop thro the current processes that is running in your system and look for process named "iexplore.exe". This is the exe that says your system is running an IE or not

u want close ie or when ie in google?
if you want close ie u must check prossecc not window

Wrong method.
Official method is with COM