CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2006
    Location
    beyond the pillars of hercules
    Posts
    295

    [RESOLVED] Refresh Dialog

    i got a win32 project, on my WinMain() function i create a dialog and i monitor the dialog events. The events are mainly from winsock ( Asynchronous Sockets ).

    The problem is that after getting the first few events , the main Dialog "Stops Responing" , although the aplication continues to work fine on the background.

    Is there a way to refresh the Dialog?

    code sample on creating the dialog
    Code:
    int WINAPI WinMain(HINSTANCE hInst,HINSTANCE hPrevInst,LPSTR lpCmdLine,int nShowCmd)
    {
    
    MSG msgs;
    HWND hwnd;
    WNDCLASSEX wClass;
    
    	ZeroMemory(&wClass,sizeof(WNDCLASSEX));
    	wClass.cbClsExtra=NULL;
    	wClass.cbSize=sizeof(WNDCLASSEX);
    	wClass.cbWndExtra=NULL;
    	wClass.hbrBackground=(HBRUSH)COLOR_WINDOW;
    	wClass.hCursor=LoadCursor(NULL,IDC_ARROW);
    	wClass.hIcon=NULL;
    	wClass.hIconSm=NULL;
    	wClass.hInstance=hInst;
    	wClass.lpfnWndProc=(WNDPROC)WinProc;
    	wClass.lpszClassName="Window Class";
    	wClass.lpszMenuName=NULL;
    	wClass.style=CS_HREDRAW|CS_VREDRAW;
    
    	RegisterClassEx(&wClass);
    
    
    	HWND hWnd=CreateWindowEx(NULL,"Window Class","Project",WS_OVERLAPPEDWINDOW,    //WS_POPUP | WS_VISIBLE
    							400,
    							200,
    							300,
    							100,NULL,NULL,hInst,NULL);
    
        ShowWindow(hWnd,nShowCmd);
    
    	ZeroMemory(&msgs,sizeof(UINT));
    
    		while(GetMessage(&msgs,NULL,0,0))
    	{
    
    		TranslateMessage(&msgs);
    		DispatchMessage(&msgs);
    	}
    	return 0;
    }

  2. #2
    Join Date
    Jul 2009
    Location
    India
    Posts
    835

    Re: Refresh Dialog

    Unless creating window like this did u try creating Dialog from resource editor and CreateDialog api to create that.

  3. #3
    Join Date
    May 2006
    Location
    beyond the pillars of hercules
    Posts
    295

    Re: Refresh Dialog

    returning wParam fixes the problem
    Code:
    return static_cast<int>(msgs.wParam);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured