|
// MainDlg.h : interface of the CMainDlg class
//
/////////////////////////////////////////////////////////////////////////////
#pragma once
#include "BitmapHyperLink.h"
class CMainDlg : public CDialogImpl<CMainDlg>, public CUpdateUI<CMainDlg>,
public CMessageFilter, public CIdleHandler
{
public:
CBitmapHyperLink m_Link1;
CBitmapHyperLink m_Link2;
CBitmapHyperLink m_Link3;
enum { IDD = IDD_MAINDLG };
virtual BOOL PreTranslateMessage(MSG* pMsg)
{
return CWindow::IsDialogMessage(pMsg);
}
virtual BOOL OnIdle()
{
return FALSE;
}
BEGIN_UPDATE_UI_MAP(CMainDlg)
END_UPDATE_UI_MAP()
BEGIN_MSG_MAP(CMainDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
END_MSG_MAP()
// Handler prototypes (uncomment arguments if needed):
// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
// center the dialog on the screen
CenterWindow();
// set icons
HICON hIcon = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME),
IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR);
SetIcon(hIcon, TRUE);
HICON hIconSmall = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME),
IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
SetIcon(hIconSmall, FALSE);
m_Link1.SetHyperLink(_T("http://msdn.microsoft.com"));
m_Link1.SetLabel(_T("Have a question? Click here"));
m_Link1.SubclassWindow(GetDlgItem(IDC_STATIC_URL1));
m_Link1.SetExtendedStyle(HLINK_LEFTIMAGE | HLINK_NOTOOLTIP);
HBITMAP hBmp = m_Link1.AddBitmap(IDB_ARROW);
ATLASSERT(hBmp);
m_Link2.SetHyperLink(_T("http://www.codeproject.com"));
m_Link2.SetLabel(_T("Welcome to the Code Project"));
m_Link2.SubclassWindow(GetDlgItem(IDC_STATIC_URL2));
m_Link2.SetExtendedStyle(HLINK_RIGHTIMAGE | HLINK_NOTOOLTIP);
hBmp = m_Link2.AddBitmap(IDB_ARROW);
ATLASSERT(hBmp);
m_Link3.SetHyperLink(_T("http://www.google.com"));
m_Link3.SetLabel(_T("Looking for something?"));
m_Link3.SubclassWindow(GetDlgItem(IDC_STATIC_URL3));
m_Link3.SetExtendedStyle(HLINK_LEFTIMAGE | HLINK_UNDERLINEHOVER | HLINK_NOTOOLTIP);
m_Link3.SetLinkColor(RGB(0, 0, 0));
m_Link3.SetVisitedColor(RGB(0, 0, 0));
m_Link3.SetHoverColor(RGB(0, 0, 255));
hBmp = m_Link3.AddBitmap(IDB_ARROW);
ATLASSERT(hBmp);
// register object for message filtering and idle updates
CMessageLoop* pLoop = _Module.GetMessageLoop();
ATLASSERT(pLoop != NULL);
pLoop->AddMessageFilter(this);
pLoop->AddIdleHandler(this);
UIAddChildWindowContainer(m_hWnd);
return TRUE;
}
LRESULT OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
CloseDialog(wID);
return 0;
}
void CloseDialog(int nVal)
{
DestroyWindow();
::PostQuitMessage(nVal);
}
};
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.