#pragma once

#define IDM_UPDATEFINISHED (WM_USER+2)
#define IDM_LOGUPDATE (WM_USER+3)

// VIBUpdateDlg dialog

class VIBUpdateDlg : public CDialog
{
	DECLARE_DYNAMIC(VIBUpdateDlg)
	int ChangeFile();
	LRESULT OnUpdateFinished(WPARAM wParam, LPARAM lParam);
	LRESULT OnLogUpdate(WPARAM wParam, LPARAM lParam);
	void OnCancel();
	BOOL OnInitDialog();
	static DWORD WINAPI LoadVbuThread(LPVOID lpParameter);
	static DWORD WINAPI UpdateThread(LPVOID lpParameter);
	unsigned short m_port;
	SOCKET m_socket;
public:
	VIBUpdateDlg(CWnd* pParent, unsigned short port);   // standard constructor
	virtual ~VIBUpdateDlg();
	HANDLE m_hLoadVbuThread;
	HANDLE m_hUpdateThread;
	CString m_pathName;
	CString m_IP;
	CString m_LogString;
	char *m_pLogBuffer;

// Dialog Data
	enum { IDD = IDD_UPDATE_DIALOG };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnBnClickedUpdateChange();
	afx_msg void OnBnClickedUpdateStart();
	afx_msg void OnBnClickedUpdateSavelog();
};
