Results 1 to 6 of 6
  1. #1
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Long Beach, California, USA
    Posts
    1,912
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Script to make IE 'reinitialize' (VBS)

    I am grasping for straws. Sorry for double posting. Is there ANY way I can write VBscript to make IE "re-read" the registry and adjust its settings accordingly?

    When an instance IE starts, it reads the registry to find all the user-specific settings -- such as tool bars, size of the windows, etc. Once it is operating, the shell CAN force IE (iexpore.exe) to re-read the registry settings and make the appropriate adjustments. That frequently happens when you open a dialog box and click the "OK" button. After you click "OK", IE is "reinialized" and the changes you specified take effect.

    OK, is there a simple VBscript that I can use to "reinitialize" Internet Explorer?? Obviously, I can do it by closing and re-opening IE -- but is there a simple script that can do the same thing??

    Thank you.

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Script to make IE 'reinitialize' (VBS)

    I'd like to think not, but... A lot of sites offer to change your home page for you. Maybe one of their scripts has the answer?

  4. #3
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Long Beach, California, USA
    Posts
    1,912
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Script to make IE 'reinitialize' (VBS)

    Hmmm... good point. But, I don't think this is something a Home Page hijack site necessarily needs to do at all. They are not interested in the "here and now", they are more interested in changing your future instances of IE.

    There may be no way to get EMBEDDED script to do this (it may be one of the functions that are 'hobbled' in IE), but SOME command of some type has to be able to do this!! Some code is used by IE to refresh itself -- and someone must know what it is!!! [img]/forums/images/smilies/smile.gif[/img]

  5. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Script to make IE 'reinitialize' (VBS)

    I've now read two other threads that I think inspired this one, and it makes more sense to continue discussion in the thread over on the Web Coding (etc.) board.

  6. #5
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Long Beach, California, USA
    Posts
    1,912
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Script to make IE 'reinitialize' (VBS)

    I would have thought so too, but it appears I am wrong -- that thread is dead in the water! This may simply NOT be possible in VBScript -- and certainly not in HTML. I have received answers elsewhere (you know me -- I use any resource I can get my hand on!) <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    Here is the up-shot:

    I need to "broadcast a WM_SETTINGCHANGE message to all top level windows". So far, no one can tell me how to do that in script. However, here is usuable VB that accomplishes exactly what I want:
    ________________

    Private Declare Function SendMessageTimeout Lib "user32" _
    Alias "SendMessageTimeoutA" (ByVal hwnd As Long, _
    ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long, _
    ByVal fuFlags As Long, ByVal uTimeout As Long, ByRef lpdwResult As Long) _
    As Long

    Private Declare Sub Sleep Lib "kernel32" _
    (ByVal dwMilliseconds As Long)

    Private Const WM_SETTINGCHANGE = &H1A
    Private Const SMTO_NORMAL = &H0
    Private Const SMTO_ABORTIFHUNG = &H2
    Private Const HWND_BROADCAST = &HFFFF

    Private Sub Form_Load()
    Dim nResult As Long
    nResult = 123

    SendMessageTimeout HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0, SMTO_NORMAL, 3000, nResult
    Unload Me
    End Sub
    ______________________

    So, I would venture to guess this belongs in the VB forum. The author claims this is "simple and not very bright" code -- but so far, it works for me. Any more comments? Thanks.

  7. #6
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Long Beach, California, USA
    Posts
    1,912
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Script to make IE 'reinitialize' (VBS)

    OK, after reviewing the above code, I think I can trim it down a little. At a bare minimum I need this:

    SendMessage HWND_BROADCAST, WM_SETTINGSCHANGE, 0, "SoftwareMicrosoftInternet ExplorerSettings"

    BUT, I may need to Declare the Function and Constants -- is this true?? I am going for the least amount of excess!

    So, if I need to make Declarations, it would be:
    ___________________

    Public Const HWND_BROADCAST = &HFFFF&
    Public Const WM_SETTINGSCHANGE = &H1A

    Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" _
    (ByVal HWND As Long, ByVal wMsg As Long, ByVal wParm As Long, lParam As Any) As Long

    Call PostMessage (HWND_BROADCAST, WM_SETTINGSCHANGE, 0, "SoftwareMicrosoftInternet ExplorerSettings")

    UnLoad Me
    ____________________

    Am I close??? Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •