// MSGDialog.cpp : ±¸Çö ÆÄÀÏÀÔ´Ï´Ù. // #include "stdafx.h" #include "MSGDialog.h" #include "InitValue.h" #include "../LoginRes/Resource.h" #include "memdc.h" #include #pragma comment(lib, "winmm") // CMSGDialog ´ëÈ­ »óÀÚÀÔ´Ï´Ù. IMPLEMENT_DYNAMIC(CMSGDialog, CDialog) CMSGDialog::CMSGDialog(CWnd* pParent /*=NULL*/) : CDialog(CMSGDialog::IDD, pParent) { } CMSGDialog::~CMSGDialog() { } void CMSGDialog::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDOK, m_Ok); DDX_Control(pDX, IDCANCEL, m_Cancel); } BEGIN_MESSAGE_MAP(CMSGDialog, CDialog) ON_WM_PAINT() ON_WM_LBUTTONDOWN() ON_WM_MOUSEMOVE() END_MESSAGE_MAP() // CMSGDialog ¸Þ½ÃÁö 󸮱âÀÔ´Ï´Ù. BOOL CMSGDialog::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here InitClientFoloder(); InitWebBrowser(); SetWindowPos( NULL, 0,0, 600, 500, SWP_NOMOVE | SWP_NOZORDER ); SetWindowText( "R.O.W Online" ); m_Ok.SetWindowPos(NULL, 182, 442, m_Ok.GetSizeX(), m_Ok.GetSizeY() , SWP_NOZORDER); m_Cancel.SetWindowPos(NULL, 319, 442, m_Cancel.GetSizeX(), m_Cancel.GetSizeY(), SWP_NOZORDER) ; return TRUE; // return TRUE unless you set the focus to a control } void CMSGDialog::InitClientFoloder(void) { HKEY hMPClientReg = 0; char strPath[MAX_PATH]=""; if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, STR_CLIENT_REGISTRY_SUBKEY, 0, KEY_READ, &hMPClientReg) == ERROR_SUCCESS) { DWORD dwReadType = 0; DWORD dwReadLens = MAX_PATH; if (RegQueryValueEx(hMPClientReg, STR_CLIENT_REGISTRY_VALUE_NAME, 0, &dwReadType, reinterpret_cast(strPath), &dwReadLens) == ERROR_SUCCESS) { strPath[MAX_PATH - 1] = 0; m_strRYLFolder.SetString(strPath); } RegCloseKey(hMPClientReg); } else { MessageBox(RYLLoginGetMessage(LOGIN_MSG_CLIENT_NOT_INSTALLED)); } } void CMSGDialog::InitWebBrowser(void) { m_WebPage.Create(NULL, NULL, (WS_CHILD | WS_VISIBLE ), CRect(32, 111, 567, 418), this, IDR_WEBVIEW, NULL); m_WebPage.Navigate(m_strRYLFolder + "/Notice/default1.html"); } void CMSGDialog::InitInterface(void) { #ifdef _NATION_GM_ m_btmBase.LoadBitmap(IDB_BITMAP_MSG); m_Ok.SetBitmap(IDB_BITMAP_MSGOK0, IDB_BITMAP_MSGOK1, IDB_BITMAP_MSGOK2); m_Cancel.SetBitmap(IDB_BITMAP_MSGNO0, IDB_BITMAP_MSGNO1, IDB_BITMAP_MSGNO2); #endif } void CMSGDialog::OnPaint() { CPaintDC dc(this); // device context for painting if (IsIconic()) { SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); // Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon // kidleon@kronet.net //dc.DrawIcon(x, y, m_hIcon); } else { CRect rect; GetClientRect(&rect); CMemDC pDC( &dc, rect); RenderBack( pDC, m_btmBase, 0, 0 ); CDialog::OnPaint(); } } void CMSGDialog::RenderBack( CDC &rDC, CBitmap &rBitmap, int Px, int Py , int SizeX, int SizeY ) { CDC memDC; memDC.CreateCompatibleDC(&rDC); CBitmap *pOldBitmap = memDC.SelectObject(&rBitmap); CSize sBitmap = rBitmap.GetBitmapDimension(); BITMAP bmInfo; rBitmap.GetBitmap(&bmInfo); if( SizeX == -1 && SizeY == -1 ) { rDC.BitBlt(Px,Py,bmInfo.bmWidth,bmInfo.bmHeight,&memDC,0,0,SRCCOPY); } else { rDC.BitBlt(Px,Py,SizeX,SizeY,&memDC,0,0,SRCCOPY); } memDC.SelectObject(pOldBitmap); } void CMSGDialog::OnLButtonDown(UINT nFlags, CPoint point) { PostMessage( WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM( point.x, point.y) ); CDialog::OnLButtonDown(nFlags, point); } void CMSGDialog::OnMouseMove(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default CDialog::OnMouseMove(nFlags, point); }