Problem displaying the Message box in MFC
        Posted  
        
            by kiddo
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by kiddo
        
        
        
        Published on 2010-05-13T12:05:29Z
        Indexed on 
            2010/05/13
            12:14 UTC
        
        
        Read the original article
        Hit count: 207
        
I have a simple MFC program which displays the progressbar..I used the below code to display the progress bar..
HWND dialogHandle = CreateWindowEx(0,WC_DIALOG,L"Proccessing...",WS_OVERLAPPEDWINDOW|WS_VISIBLE,
                    600,300,280,120,NULL,NULL,NULL,NULL);
HWND progressBarHandle =  CreateWindowEx(NULL,PROGRESS_CLASS,NULL,WS_CHILD|WS_VISIBLE|PBS_MARQUEE,40,20,200,20,
            dialogHandle,(HMENU)IDD_PROGRESS,NULL,NULL);
while(FALSE == testResult)
    {
        MSG msg;
         SendMessage(progressBarHandle, PBM_SETRANGE, 0, MAKELPARAM( 0, 100 ) );
        SendMessage(progressBarHandle,PBM_SETPOS,0,0);
        ShowWindow(progressBarHandle,SW_SHOW);
        Sleep(50);
             if(TRUE == myCondition)//myCondition is a bool variable which is decalred globally
            {
                DestroyWindow(dialogHandle);
                 AfxMessageBox(L"Test Success");
             }
        }
when I execute the above code..the message box displays only after a mouseover event.like if I move the mouse the message box will display if not it will not display until i move the mouse. And also while the progressbar is running if I try to move the progress bar window..it displays a windows background at the place of displacement and also in the new region or sometimes its getting stuck.Please help me with this!
© Stack Overflow or respective owner