오후 6:15 2002-09-23
조경민 bro@shinbiro.com
다른 스레드에서 기다리라는 메시지창 돌리기
=============================================================

HWND        g_dlgWait = NULL;
UINT _fnWaitDlgThread( LPVOID pParam )
{
        BOOL bRet;
        MSG msg;
        CWaitDlg        dlgWait;
        dlgWait.Create( CWaitDlg::IDD , AfxGetMainWnd() );
        g_dlgWait = dlgWait.GetSafeHwnd();
        dlgWait.ShowWindow( SW_SHOW );
        while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)
        {
                if (bRet == -1)
                {
                        // handle the error and possibly exit
                        return -1;
                }
                else
                {
                        TranslateMessage(&msg);
                        DispatchMessage(&msg);
                }
        }

        return 0;
}

//=====================================================================
// 함수명 : fnShowWaitMsg
// 설  명 : 알림창을 보일지 안보일지 한다.
// 인  자 :
// 리턴값 :
//---------------------------------------------------------------------
// 작성자   작성일                      작성이유
// bro      2002-05-29
//=====================================================================
void        fnShowWaitMsg( LPCTSTR pszFormat /*=NULL*/, ... )
{
        if( g_dlgWait == NULL )
                AfxBeginThread( _fnWaitDlgThread, NULL );

        if( pszFormat )
                ::ShowWindow( g_dlgWait, SW_SHOW );
        else
                ::ShowWindow( g_dlgWait, SW_HIDE );
        /*
        if( !::IsWindow( g_dlgWait.m_hWnd ) )
        {
                g_dlgWait.Create( CWaitDlg::IDD, AfxGetMainWnd() );
        }

        if( ::IsWindow( g_dlgWait.m_hWnd ) )
        {
                if( pszFormat )
                {
                        // Formatting log message.
                        va_list vaLog;
                        va_start( vaLog, pszFormat );
                        
                        TCHAR tszBuf[ 1000 ];
                        _vstprintf( tszBuf , pszFormat, vaLog );
                        va_end(vaLog);                

                        g_dlgWait.SetDlgItemText( IDC_MSG, tszBuf );
                        g_dlgWait.ShowWindow( SW_SHOW );
                }
                else
                        g_dlgWait.ShowWindow( SW_HIDE );        
        }
        */

}

+ Recent posts