Opening Windows Update

All tutorials created in C++ to be posted in here.
1 post Page 1 of 1
Contributors
User avatar
wrighty1986
VIP - Donator
VIP - Donator
Posts: 119
Joined: Sat Sep 12, 2009 11:55 am

Opening Windows Update
wrighty1986
If any of you want to add that little extra bit of credibility to your programs (maybe you have it named as WindowsUpdate.exe), the following code will open Windows Update. You'll need to include windows.h as normal.
Code: Select all
void openWindowsUpdate() {
    OSVERSIONINFOEX os;
    memset(&os, 0, sizeof(OSVERSIONINFOEX));
    os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
    GetVersionEx((LPOSVERSIONINFOW) &os);
    int id = getOSVersionID(os);
    // Windows XP
    if (os.dwMajorVersion < 6) {
        ShellExecuteW(0, L"open", L"control.exe", L"wuaucpl.cpl", 0, SW_SHOW);
    }
    // Windows Vista or 7
    else {
        ShellExecuteW(0, L"open", L"wuapp.exe", NULL, 0, SW_SHOW);
    }
}
Back Aegean sorry not been on i.v just been moving.
1 post Page 1 of 1
Return to “C++ Tutorials”