|
// PictureExDlg.cpp : Implementation of CPictureExDlg
#include "stdafx.h"
#include "PictureExDlg.h"
#include "AboutDlg.h"
#include "shellapi.h" // for ShellExecute
/////////////////////////////////////////////////////////////////////////////
// CPictureExDlg
CPictureExDlg::CPictureExDlg() : m_hCursor(NULL)
{
}
CPictureExDlg::~CPictureExDlg()
{
}
LRESULT CPictureExDlg::OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
EndDialog(wID);
return 0;
}
LRESULT CPictureExDlg::OnAbout(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
CAboutDlg dlg;
dlg.DoModal();
return 0;
}
LRESULT CPictureExDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
// Set application icon
HICON hIcon = LoadIcon(_Module.GetResourceInstance(),
MAKEINTRESOURCE(IDI_PICTUREEXDEMO));
SetIcon(hIcon);
CenterWindow();
m_hCursor = LoadCursor(_Module.GetResourceInstance(),MAKEINTRESOURCE(IDC_HAND));
HWND hWnd = GetDlgItem(IDC_BANNER);
if (hWnd)
{
m_wndBanner.SubclassWindow(hWnd);
if (m_wndBanner.Load(MAKEINTRESOURCE(IDR_BANNER),_T("GIF")))
m_wndBanner.Draw();
};
return 1; // Let the system set the focus
}
LRESULT CPictureExDlg::OnSetCursor(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
RECT rect;
::GetWindowRect(m_wndBanner.m_hWnd,&rect);
POINT point;
GetCursorPos(&point);
if (PtInRect(&rect,point))
{
if (m_hCursor) SetCursor(m_hCursor);
bHandled = TRUE;
return S_OK;
};
bHandled = FALSE;
return S_OK;
}
LRESULT CPictureExDlg::OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
RECT rect;
::GetWindowRect(m_wndBanner.m_hWnd,&rect);
POINT point;
GetCursorPos(&point);
if (PtInRect(&rect,point))
{
ShellExecute(m_hWnd,_T("open"),_T("http://www.rsdn.ru"),_T(""),NULL,0);
};
return S_OK;
}
|
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 article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.