Solved

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

Posted on 2002-05-29
7
227 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
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 viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

777 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