// UIThread.cpp : implementation file
//

#include "stdafx.h"
#include "WatkiUI2.h"
#include "UIThread.h"
#include "afxmt.h"

// CUIThread
extern int posG;
extern int sleepTime;
extern CEvent *pEvent;

IMPLEMENT_DYNCREATE(CUIThread, CWinThread)

UINT ThreadFun2(LPVOID pParam)
{
    int i;
    for(i = posG; i < 100; i++)
    {
        SendDlgItemMessage((HWND)pParam, IDC_PROGRESS2, PBM_SETPOS, (int)i, 0);
        Sleep(sleepTime);
    }
    pEvent->SetEvent();
    return 0;
}

CUIThread::CUIThread()
{
}

CUIThread::~CUIThread()
{
}

BOOL CUIThread::InitInstance()
{
    CDialog* dialog = new CDialog();
    dialog->Create(IDD_DIALOG1);
    dialog->ShowWindow(SW_SHOW);
    
    CWinThread *pThread = AfxBeginThread(ThreadFun2, (LPVOID)dialog->m_hWnd);
    
    return TRUE;
}

int CUIThread::ExitInstance()
{
	// TODO:  perform any per-thread cleanup here
	return CWinThread::ExitInstance();
}

BEGIN_MESSAGE_MAP(CUIThread, CWinThread)
END_MESSAGE_MAP()


// CUIThread message handlers
