Error in ShowWindow()
-
Hello Friends, I am using win32 application. In that I hide the Application on Dialog Initialization and put the icon in the taskbar. I am using the Context menu in taskbar. Ans Want to show the window when someone choose the
Exit
option of the menu. But it show me the strange Error. Error code = 0x000005B4 which means "This operation returned because the timeout period expired. " I am using following codeLRESULT CALLBACK MyDialogProc(...)
{
ShowWindow(hWndDlg,SW_HIDE); //Hide the main window
switch(message)
{
case WM_TASKMSG: //user Messages for Task Manager
if(lParam == WM_RBUTTONDOWN)
{
POINT pt;
GetCursorPos(&pt);
TrackPopupMenuhmenuTrackPopup,NULL,pt.x ,pt.y,0,hWndDlg,NULL);
}
break;case WM\_COMMAND : //Handling Context Menu Messages switch(LOWORD(wParam)) { case ID\_Exit: if( ! ShowWindow(hWndDlg,SW\_SHOWNORMAL) ) { //Here getting the Error that TimeOut Expire **dError = GetLastError();** } } }
}
I search lot on google for this error but it show that this type of error comes with database(SQL Connection) only.And not getting any solution
Please Help me if u know the solution. Thnx in advance[ Screen Capture ][ Tool Tip ]
-
Hello Friends, I am using win32 application. In that I hide the Application on Dialog Initialization and put the icon in the taskbar. I am using the Context menu in taskbar. Ans Want to show the window when someone choose the
Exit
option of the menu. But it show me the strange Error. Error code = 0x000005B4 which means "This operation returned because the timeout period expired. " I am using following codeLRESULT CALLBACK MyDialogProc(...)
{
ShowWindow(hWndDlg,SW_HIDE); //Hide the main window
switch(message)
{
case WM_TASKMSG: //user Messages for Task Manager
if(lParam == WM_RBUTTONDOWN)
{
POINT pt;
GetCursorPos(&pt);
TrackPopupMenuhmenuTrackPopup,NULL,pt.x ,pt.y,0,hWndDlg,NULL);
}
break;case WM\_COMMAND : //Handling Context Menu Messages switch(LOWORD(wParam)) { case ID\_Exit: if( ! ShowWindow(hWndDlg,SW\_SHOWNORMAL) ) { //Here getting the Error that TimeOut Expire **dError = GetLastError();** } } }
}
I search lot on google for this error but it show that this type of error comes with database(SQL Connection) only.And not getting any solution
Please Help me if u know the solution. Thnx in advance[ Screen Capture ][ Tool Tip ]
GauranG33 wrote:
I am using win32 application. In that I hide the Application on Dialog Initialization and put the icon in the taskbar. I am using the Context menu in taskbar. Ans Want to show the window when someone choose the Exit option of the menu. But it show me the strange Error. Error code = 0x000005B4 which means "This operation returned because the timeout period expired. "
First, don't hide a window in the first line of a dialog proc. It will be called many times for many reasons. Also, I think calling ShowWindow could involve a recursive call to your dialog proc, which immediately hides the window again. Nathan
-
GauranG33 wrote:
I am using win32 application. In that I hide the Application on Dialog Initialization and put the icon in the taskbar. I am using the Context menu in taskbar. Ans Want to show the window when someone choose the Exit option of the menu. But it show me the strange Error. Error code = 0x000005B4 which means "This operation returned because the timeout period expired. "
First, don't hide a window in the first line of a dialog proc. It will be called many times for many reasons. Also, I think calling ShowWindow could involve a recursive call to your dialog proc, which immediately hides the window again. Nathan
Hi. Thnx for you reply. Can you please tell, Then Where to put the
ShowWindow()
Funcion to hide the Window. Because when I use it at the statring or ending of WM_INITDIALOG it shows me different errors as followsWM_INITDIALOG:
{
//This Show the dError = 02, Which means "The system cannot find the file specified."
if( ! ShowWindow(hWndDlg,SW_HIDE) ) //Hide the main window
dError = GetLastError();...
...
//Other code that Deals with the Registry and System Tray ICONS
//This Show the dError = 0x000000aa , Which means "The requested resource is in use."
if( ! ShowWindow(hWndDlg,SW_HIDE) ) //Hide the main window
dError = GetLastError();}
[ Screen Capture ][ Tool Tip ]
-
Hi. Thnx for you reply. Can you please tell, Then Where to put the
ShowWindow()
Funcion to hide the Window. Because when I use it at the statring or ending of WM_INITDIALOG it shows me different errors as followsWM_INITDIALOG:
{
//This Show the dError = 02, Which means "The system cannot find the file specified."
if( ! ShowWindow(hWndDlg,SW_HIDE) ) //Hide the main window
dError = GetLastError();...
...
//Other code that Deals with the Registry and System Tray ICONS
//This Show the dError = 0x000000aa , Which means "The requested resource is in use."
if( ! ShowWindow(hWndDlg,SW_HIDE) ) //Hide the main window
dError = GetLastError();}
[ Screen Capture ][ Tool Tip ]
Do you know what
ShowWindow()
returns? Your code assumes that if it returns a zero value, there must've been an error. That's an incorrect assumption.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Hi. Thnx for you reply. Can you please tell, Then Where to put the
ShowWindow()
Funcion to hide the Window. Because when I use it at the statring or ending of WM_INITDIALOG it shows me different errors as followsWM_INITDIALOG:
{
//This Show the dError = 02, Which means "The system cannot find the file specified."
if( ! ShowWindow(hWndDlg,SW_HIDE) ) //Hide the main window
dError = GetLastError();...
...
//Other code that Deals with the Registry and System Tray ICONS
//This Show the dError = 0x000000aa , Which means "The requested resource is in use."
if( ! ShowWindow(hWndDlg,SW_HIDE) ) //Hide the main window
dError = GetLastError();}
[ Screen Capture ][ Tool Tip ]
GauranG33 wrote:
Can you please tell, Then Where to put the ShowWindow() Funcion to hide the Window.
I haven't seen your code to create the dialog, but your problem could be that it's a modal dialog, which makes specific assumptions about when the dialog is shown and hidden. If you make a modeless dialog and its template doesn't specify that the window is visible, then the dialog will remain hidden till you want to show it.