Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Error in ShowWindow()

Error in ShowWindow()

Scheduled Pinned Locked Moved C / C++ / MFC
databasehelpcom
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GauranG Shah
    wrote on last edited by
    #1

    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 code

    LRESULT 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 ]

    N 1 Reply Last reply
    0
    • G GauranG Shah

      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 code

      LRESULT 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 ]

      N Offline
      N Offline
      Nathan Holt at EMOM
      wrote on last edited by
      #2

      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

      G 1 Reply Last reply
      0
      • N Nathan Holt at EMOM

        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

        G Offline
        G Offline
        GauranG Shah
        wrote on last edited by
        #3

        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 follows

        WM_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 ]

        D N 2 Replies Last reply
        0
        • G GauranG Shah

          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 follows

          WM_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 ]

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • G GauranG Shah

            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 follows

            WM_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 ]

            N Offline
            N Offline
            Nathan Holt at EMOM
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups