Determine what browser is active on XP & win 98 os thru C++ coding

How can I determine what browser ( IE / Netscape / Opera) is active though C++ coding i.e. is there a flag set in the registry or an api call that could find the answer ? Need it for xp and 98 os.
thxs ............r
rexmanAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
DanRollinsConnect With a Mentor Commented:
By 'active browser' I think you mean the one that the user is working with at a certain moment in time (rather than the browser that the user has chosen as the default browser).

There are several scenarios:

1) There is no browser active
2) Both Netscape and IE are active, but neither is in front (imagine that Notepad.Exe is in front)
3) Both Netscape and IE are active, and IE is in front.
4) Both Netscape and IE are active, and Netscape is in front.
5) IE is open and is in front
6) Netscape is open and in front
7) Netscape is active, but a popup add generated by a minimized IE browser window is in the foreground.

So...
I suggest using GetForegroundWindow() then pass the HWND to GetWindowInfo and/or and/or GetWindowText and/or GetClassName.  That should provide enough info for satisify scenarios 3,4,5,6, or 7.  For other siturations, you are on your own.  Also, if your program is frontmost at the time, these will not help because now browser is active at that time.

Now if you want to see if any browser is open, you can uyse FindWindowEx or EnumWindows to cycle through all top-level windows and see what's what.
=-=-=-=-=-=-=-=--=
Why do you want to know?  If you explain that, I may be able to provide more specific info.

-- Dan
0
 
jkrCommented:
You could get that info from the registry, but 'FindExecutable()' will render that also...
0
 
jkrCommented:
BTW, the place to look that up in the registry is

HKEY_CLASSES_ROOT\htmlfile\shell\open\command
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
rexmanAuthor Commented:
thxs jkr,
but I have checked the registry location that you mentioned and there was just a path to iexplore.ex, no matter what browser I had active (Only one browser was active at a time). FindExecutable() retrieves the name of and handle to the executable file associated with the specified file name. So if I use this function for each of the browser's .exe it should return file not found for the two browsers that are not active and a value greater that 32 for the current active browser ?
0
 
griesshCommented:
Dear rexman

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "DanRollins"

comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points. The link to the Community Support area is: http://www.experts-exchange.com/commspt/


PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
rexmanAuthor Commented:
Sorry for not responding to DanRollins, but I got sidetracked for a while and when I returned to my question I found an easier answer to the question. I just take a snapshot of the active processes and search for all the browsers to determine which or how many of the
browsers the user currently has active.

but I accept DanRollins answer.
thxs....rexman
0
 
DanRollinsCommented:
hi rexman,
To award points to me, please click the [Accept Comment as Answer] button next to my comment.  In the next screem, choose a grade and click the [Submit] button.  Thanks!
-- Dan
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.