Solved

Default browser

Posted on 2012-03-09
8
624 Views
Last Modified: 2012-03-11
Hi Experts,

Every time I run the following code, since the internet explorer is not my default browser, the message "Internet Explorer is not currently your default browser. Would you like to make it your default browser?" always comes up.

Private Sub Command1_Click()
Text1 = ""
    Dim IE As Object
    Set IE = CreateObject("InternetExplorer.Application")
    IE.Navigate "http://free.timeanddate.com/clock/i1up141f/n240/tt1/tw0/tm2"
    IE.Toolbar = False
    IE.StatusBar = False
    IE.MenuBar = False
    Do While IE.Busy
        Do While IE.Busy
            DoEvents
        Loop
    Loop
    Text1 = CDate(IE.Document.getElementById("t1").InnerText)
    IE.Quit
    Set IE = Nothing
End Sub

How can I suppress or bypass that message with the Internet Explorer as the browser to get the result I want in Text1 ?
or how to use the default browser so the message above would not appear to get the same result in text1 ?

Thanks
0
Comment
Question by:LoGa1234567890
8 Comments
 

Expert Comment

by:ethanw023
ID: 37704076
In Internet Explorer options, click Programs, in there is a checkbox that says "Tell me if Internet Explorer is not the default browser", uncheck that.
0
 
LVL 7

Expert Comment

by:micropc1
ID: 37704102
I'm assuming you're wanting to not require any user interaction, which is why you didn't just click "Yes" to set IE as the default browser in the first place... Have your VB code set the registry key "\HKLM\Software\Microsoft\Internet Explorer\Main\Check_Associations" to a REG_SZ value of "no". This will prevent IE from checking if it is the default browser and prevent the prompt from appearing.
0
 
LVL 1

Expert Comment

by:DGM87
ID: 37704114
Yeah, because the code is looking for IE, so it's pulling it up.  What Micropc said should do it.
0
 

Author Comment

by:LoGa1234567890
ID: 37704250
Thank you for the prompt reply !

How to code vb6 to set the registry key "\HKLM\Software\Microsoft\Internet Explorer\Main\Check_Associations" to a REG_SZ value of "no" ?
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 7

Expert Comment

by:micropc1
ID: 37704273
This may help... http://www.ex-designz.net/apidetail.asp?api_id=183

Another option would be to use the shell command to run regedit.exe and import a .reg file.
http://www.robvanderwoude.com/regedit.php
0
 

Author Comment

by:LoGa1234567890
ID: 37706050
Hi micropc1,

Using regedit and open the Registry Editor, I can get it work with HKEY_CURRENT_USER, ( I tried HKEY_LOCAL_MACHINE, but not work).

I tried to run the following code in form_load to let vb do this job , but got error in line 5 (Set objAccount----)

Dim strComputer, strUserDN, strUserDomain, checkAssociations As String
Dim WshShell, objShell, objWMIService, objAccount As Object
  strComputer = "."
  Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
  Set objAccount = objWMIService.Get("Win32_UserAccount.Name='" & strUserDN & "',Domain='" & strUserDomain & "'")
  MsgBox (strUserDN & " SID = " & objAccount.SID)
  'Read for existing SID entry for Check_Associations
  checkAssociations = "Yes"
  checkAssociations = WshShell.RegRead("HKEY_USERS\" & objAccount.SID & "\Software\Microsoft\Internet Explorer\Main\Check_Associations")
  If checkAssociations <> "No" Then
'    Create desired reg entry
    objShell.RegWrite "HKEY_USERS\" & objAccount.SID & "\Software\Microsoft\Internet Explorer\Main\Check_Associations", "No", "REG_SZ"
  End If

Please help !
0
 
LVL 7

Accepted Solution

by:
micropc1 earned 400 total points
ID: 37706122
Sorry, I believe I was mistaken about HKLM...just tested it and it doesn't work. Looks like HKCU is what you want.

Try this...

Dim strComputer, CAKey, checkAssociations As String
Dim WshShell

Set WshShell = CreateObject("Wscript.Shell")
CAKey = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Check_Associations"

If WshShell.RegRead(CAKey) <> "No" Then
    WshShell.RegWrite CAKey, "No", "REG_SZ"
End If

Open in new window

0
 

Author Closing Comment

by:LoGa1234567890
ID: 37706346
Thanks ! micropc1, your code works perfectly.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

758 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

13 Experts available now in Live!

Get 1:1 Help Now