kalvillo
asked on
Visual C++ 6.x and Windows Vista
Hi.
I made an application in Visual C++ 6.0.
I want this application to hide its window when it's running; i'm using the following command to do this:
ShowWindow(GetForeGroundWi ndow(), SW_HIDE)
This instruction works perfectly on Windows XP, but on Windows Vista sometimes it works, sometimes don't...
What can i do?
Thanks.
I made an application in Visual C++ 6.0.
I want this application to hide its window when it's running; i'm using the following command to do this:
ShowWindow(GetForeGroundWi
This instruction works perfectly on Windows XP, but on Windows Vista sometimes it works, sometimes don't...
What can i do?
Thanks.
If you are attempting to hide the window from within the window class that must be hidden, change to:
ShowWindow(SW_HIDE);
The SetForeGroundWindow() instruction is attempting to put your window in the foreground which I dont think you want to do within the same instruction.
ShowWindow(SW_HIDE);
The SetForeGroundWindow() instruction is attempting to put your window in the foreground which I dont think you want to do within the same instruction.
ASKER
Here is the thing...
I'm trying to make a server application, this application needs to be in the background to "listen" the port 80 and serve all the client applications.
We tried all the expert suggestions but none of them worked (except using MFC, but it's too late to use it right now).
This server application runs on a MS-DOS window-like, and we need to hide it (the main reason is that we don't want that the final user closes it accidentally and disrupt the functionallity of all the clients).
Using the instruction
HWND ghWnd = GetForegroundWindow
works perfectly on WinXP, but on Vista sometimes works, sometimes doesn't.
We debbuged it and never returns NULL, but i don't know if this result is provided by another window and not that of my server application...
Is there another way to solve this problem? is there another instruction to surely detect the handler of my window and hide it and not another?
Thank you
I'm trying to make a server application, this application needs to be in the background to "listen" the port 80 and serve all the client applications.
We tried all the expert suggestions but none of them worked (except using MFC, but it's too late to use it right now).
This server application runs on a MS-DOS window-like, and we need to hide it (the main reason is that we don't want that the final user closes it accidentally and disrupt the functionallity of all the clients).
Using the instruction
HWND ghWnd = GetForegroundWindow
works perfectly on WinXP, but on Vista sometimes works, sometimes doesn't.
We debbuged it and never returns NULL, but i don't know if this result is provided by another window and not that of my server application...
Is there another way to solve this problem? is there another instruction to surely detect the handler of my window and hide it and not another?
Thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
it's not sure that 'GetForeGroundWindow' returns your application's window - see MSDN about it: 'The foreground window can be NULL in certain circumstances, such as when a window is losing activation.'
What kind of application is it? Isn't there another way to get access to the window (I think there must be one since you create the window - easiest could be to unset the style 'WS_VISIBLE' at creation)
Hope that helps,
ZOPPO