Solved

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

Posted on 2002-05-29
7
205 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

705 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

20 Experts available now in Live!

Get 1:1 Help Now