-
C++ (
http://www.daniweb.com/forums/forum8.html)
| clutchkiller | Jan 7th, 2009 7:38 pm | |
| ShowWindow(FindWindow 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 |
| William Hemsworth | Jan 7th, 2009 8:08 pm | |
| Re: ShowWindow(FindWindow 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. |
| clutchkiller | Jan 7th, 2009 8:16 pm | |
| Re: ShowWindow(FindWindow 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. |
| Comatose | Jan 8th, 2009 1:38 am | |
| Re: ShowWindow(FindWindow #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. |
| clutchkiller | Jan 8th, 2009 2:44 pm | |
| Re: ShowWindow(FindWindow thanks comatose, ill dink around with what you just showed me and make it work in the proper context im looking for. |
| All times are GMT -4. The time now is 4:13 pm. | |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC