Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ Access Runtime, Packaging & Deployment _ Open Windows 10 Update Screen In Code

Posted by: DaveH Nov 7 2019, 11:42 AM

Does anyone know how to access/open what used to be a Control Panel (CPL) object “Windows Update” - in Windows 10… in code?

Although this is utilised in an installer for an Access database project which is written in VB.NET - after the Access 2016 runtime is installed, I have found that programmatically downloading the required updates (about 30) takes an absolute age so I would like the users to be able to observer whats happening as in Windows 10.

I can easily do this in Windows 7 but not 10. Is this even possible?

Developed on a Windows 7 machine for installation in 7 and 10.

Many thanks.

Posted by: jleach Nov 8 2019, 05:18 AM

Hi - try shelling the appropriate command:

CODE
Function OpenControlPanelUpdates()
  Shell "control update"
End Function


hth

Posted by: DaveH Nov 8 2019, 06:36 AM

Jack,

I've been searching for this command for ages...

Much appreciated, thanks a lot.

Dave.

Posted by: jleach Nov 8 2019, 06:45 AM

No problem. I was surprised it took me me quite a few tries as well to find the one that worked.

Cheers,

Posted by: DaveH Nov 10 2019, 05:10 AM

This may be of interest to someone concerning performing the same function as the VBA call to open the control Panel item Windows Update, Shell “control update”. This works in Windows 10 (from a VBA app) because the operating system “Shims” the call as Windows 10 Update is no longer in control panel but settings.

Below is the process in VB.NET that does the same thing: -


Dim Ops As String = My.Computer.Info.OSFullName.ToString
Dim SysDrive As String = Environment.GetEnvironmentVariable("SystemDrive")

If InStr(Ops, "Windows 10") Then
Process.Start("" & SysDrive & "\Windows\explorer.exe", "ms-settings:windowsupdate")
Environment.Exit(0)
End If

Posted by: cheekybuddha Nov 10 2019, 05:57 AM

So, if you want to do the same thing from VBA you can use:

CODE
  Shell "explorer.exe ms-settings:windowsupdate", vbNormalFocus

Or, if you want to grab the process id in case you want to close the window programtically, you can use:
CODE
  Dim PID As Long

  PID = Shell("explorer.exe ms-settings:windowsupdate", vbNormalFocus)
' Use taskkill with PID to end process