Solved

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

Posted on 2002-05-29
7
218 Views
Last Modified: 2010-04-02
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
0
Comment
Question by:rexman
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 7042350
You could get that info from the registry, but 'FindExecutable()' will render that also...
0
 
LVL 86

Expert Comment

by:jkr
ID: 7042363
BTW, the place to look that up in the registry is

HKEY_CLASSES_ROOT\htmlfile\shell\open\command
0
 

Author Comment

by:rexman
ID: 7044556
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 49

Accepted Solution

by:
DanRollins earned 100 total points
ID: 7045391
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
 
LVL 11

Expert Comment

by:griessh
ID: 7178860
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
 

Author Comment

by:rexman
ID: 7185345
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
 
LVL 49

Expert Comment

by:DanRollins
ID: 7193793
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now