For the 2 parameters lpClassName and lpWindowName in FindWindow, what do i throw in there to hide all open windows? Is this possible? MSDN makes it sound like if both parameters are null, that will do the trick, but before i test it, i want to make sure that works so i dont have to restart my computer before i reverse the action

FindWindow will only return a handle to one window, to do this you will have to loop through all opened applications and hide them one at a time. Try looking up the EnumWindows function, it may provide your solution.

I looked that function up, but im still confused, could you elaborate on a proper method to hide all open windows? Im still a new programmer/windows programmer.

#include <windows.h>
#include <iostream>
#include <vector>

using namespace std;

std::vector<HWND> vis;

bool EnumWindowsProc(HWND hWnd, long lParam)
{

    if (IsWindowVisible(hWnd)) {
        vis.push_back(hWnd);
    }

    return true;
}


int main()
{
    EnumWindows((WNDENUMPROC)EnumWindowsProc, 0);

    for (int i=0; i < (int)vis.size(); i++) {
        ShowWindow(vis[i], SW_HIDE);
    }

    Sleep(10000);

    for (int i=0; i < (int)vis.size(); i++) {
        ShowWindow(vis[i], SW_SHOW);
    }


    return 0;
}

Just remember to add code which prevents you from hiding the console window (ie: the one that they need in order to type in their password). This program as it is now, simply hides all windows for a short amount of time, and then makes them show up again.

thanks comatose, ill dink around with what you just showed me and make it work in the proper context im looking for.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.