UAC & Internetexplorer.Application

Okay, so it was all smooth sailing until I had a friend test out a gadget; then things got complicated.

Simple Script:

Code: vbscript
  1. Sub Object_OnScriptEnter
  2.  Set objExplorer = CreateObject("InternetExplorer.Application")
  3.  objExplorer.Navigate "about:blank"
  4.  objExplorer.ToolBar = 0
  5.  objExplorer.StatusBar = 1
  6.  objExplorer.Width = 300
  7.  objExplorer.Height = 150
  8.  objExplorer.Left = 0
  9.  objExplorer.Top = 0
  10.  objExplorer.Visible = 1
  11. End Sub

Long story short: I have UAC turned off, so it worked fine. But with my friend's UAC turned on, it won't allow the gadget to set any of iexplorer properties. It'll open iexplorer all right and navigate to the url, but I really need the window to open in a specific size or I might as well forget the function altogether. Can't expect the end-user to turn off their UAC just for this gadget, and I haven't seen any way to get Vista to allow the script.

I'd use DX ActiveX web browser, but the site I'm navigating to uses shockwave flash, and, with UAC turned on, it crashes DXBuilder before Vista can ask for permission to run the site.

It's the first time I'm doing a really internet-intensive gadget and I'm finding UAC to be a royal pain.:annoyed:

 

Any workarounds or ideas?

7,001 views 5 replies
Reply #1 Top

I'm not sure that this will solve all of your problems. However I use the same method to work with WMI. So look below please:

 

1. Write your IE script and save it as a text file (myie.vbs). For example:

  Dim objExplorer
  

  Set objExplorer = CreateObject("InternetExplorer.Application")
    objExplorer.ToolBar = 0
    objExplorer.StatusBar = 1
    objExplorer.Width = 300
    objExplorer.Height = 150
    objExplorer.Left = 0
    objExplorer.Top = 0
    objExplorer.Navigate "about:blank"
    objExplorer.Visible = 1

etc......

2. Add this file to the "Custom files" of your main object (on the bottom of the object "Summary" tab)

3. Add this code into your DX script and try to run it:

 Sub Object_OnScriptEnter
  Dim objWSH
  Set objWSH = CreateObject("Shell.Application")
   objWSH.ShellExecute  "cscript.exe", Chr(34) & object.Directory&"myie.vbs" & Chr(34),"", "runas", 0
   If err.number > 0 Then err.clear
  Set objWSH = nothing
End Sub

By this way your script will run with Administrator rights and UAC will not be able to disturb you.

Best Regards. |-)

P.S. Vista UAC is not a royal pain. This is a big Microsoft's Shame! #:(

P.P.S. Don't use this code for XP!!! It for Vista only!!!

 

 

+2 Loading…
Reply #3 Top

Thank you! Thank you! Thank you, Vad!\o/    It works brilliantly.  You are awesome. k6

Reply #4 Top

Vad_M = Vad Master

Me right, master? ;)

Reply #5 Top

Vad_M = Vad Master

Alas this is not right. I just skiped one character in my name. :blush:

sViz,

Not at all!  I'm glad to see that it helped you. :sun: