| | |
ShowWindow(hWnd, SW_HIDE); Does not work -- Only with "SW_HIDE" ???
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Feb 2008
Posts: 51
Reputation:
Solved Threads: 0
Heya i want to use ShowWindow(hWnd, SW_HIDE); to hide some application,
The problem is that the code i wrote works perfectly for any application except the one i need it for
heres the code
it does execute the line "ShowWindow(hWnd, SW_HIDE);" but it has no affect on the application, while if i put "SW_MAXIMIZE" , "SW_MINIMIZE" or any other "SW_***" it works perfectly and does manipulation on the application window,
Any idea why SW_HIDE does not work while all other SW_*** works?
Thanks Ahead....
The problem is that the code i wrote works perfectly for any application except the one i need it for
heres the code
C++ Syntax (Toggle Plain Text)
HWND hWnd = FindWindow(NULL, sName); if(hWnd) { ShowWindow(hWnd, SW_HIDE); }
it does execute the line "ShowWindow(hWnd, SW_HIDE);" but it has no affect on the application, while if i put "SW_MAXIMIZE" , "SW_MINIMIZE" or any other "SW_***" it works perfectly and does manipulation on the application window,
Any idea why SW_HIDE does not work while all other SW_*** works?
Thanks Ahead....
Try calling ShowWindow twice, according to MSDN the second parameter to ShowWindow() might get ignored the first time it is called. I don't know if it will work, but its worth a try.
C++ Syntax (Toggle Plain Text)
HWND hWnd = FindWindow(NULL, sName); if(hWnd) { ShowWindow(hWnd, SW_HIDE); ShowWindow(hWnd, SW_HIDE); }
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown.
I suspect the window you are trying to hide processes this message and prevents itself from hiding.
You might use Spy++ to see wheather or not this notification is send to the target Window.
I suspect the window you are trying to hide processes this message and prevents itself from hiding.
You might use Spy++ to see wheather or not this notification is send to the target Window.
I know I am. Therefore I am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
•
•
Join Date: Feb 2008
Posts: 51
Reputation:
Solved Threads: 0
Hi again... I found the solution...
1)This phenomenon happens with only one specific window...
2)To force this window to hide I do need call the "ShowWindow(hWnd, SW_HIDE);" Twice in the following way:
I could call twice the myClass::FocusP(str); twice, but i prefered to split it... looks better IMO
Thx 4 the help Ancient Dragon and others...
1)This phenomenon happens with only one specific window...
2)To force this window to hide I do need call the "ShowWindow(hWnd, SW_HIDE);" Twice in the following way:
C++ Syntax (Toggle Plain Text)
myClass::FocusP(str); myClass::Hidep(str); ... ... ... void myClass::FocusP(CString str) { HWND hWnd = FindWindow(NULL, str); if(hWnd){ ShowWindow(hWnd, SW_MINIMIZE); ShowWindow(hWnd, SW_HIDE); } } void myClass::Hidep(CString str) { HWND hWnd = FindWindow(NULL, str); if(hWnd){ ShowWindow(hWnd, SW_HIDE); } }
I could call twice the myClass::FocusP(str); twice, but i prefered to split it... looks better IMO
Thx 4 the help Ancient Dragon and others...
![]() |
Other Threads in the C++ Forum
- Previous Thread: Marital tax revamped
- Next Thread: Is this normal?
| Thread Tools | Search this Thread |
api array based binary c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






