|
// clover.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "clover.h"
#include "MainFrm.h"
#include "win/hyperlink.h"
#include "win/mfcpp.h"
#include "win/windebug.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCloverApp
BEGIN_MESSAGE_MAP(CCloverApp, CWinApp)
//{{AFX_MSG_MAP(CCloverApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCloverApp construction
CCloverApp::CCloverApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CCloverApp object
CCloverApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CCloverApp initialization
BOOL CCloverApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
// To create the main window, this code creates a new frame window
// object and then sets it as the application's main window object.
CMainFrame* pFrame = new CMainFrame;
m_pMainWnd = pFrame;
// create and load the frame with its resources
pFrame->LoadFrame(IDR_MAINFRAME,
WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL,
NULL);
// The one and only window has been initialized, so show and update it.
pFrame->ShowWindow(SW_SHOW);
pFrame->UpdateWindow();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CCloverApp message handlers
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CDemoLink : public CHyperLink
{
protected:
virtual void OnSelect(void)
{ ((CFrameWnd *)AfxGetMainWnd())->SetMessageText(m_strURL); }
virtual void OnDeselect(void)
{ ((CFrameWnd *)AfxGetMainWnd())->SetMessageText(AFX_IDS_IDLEMESSAGE); }
};
class CAboutDlg : public CHyperLinkDlg
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
CDemoLink m_DemoIcon;
CDemoLink m_DemoMail;
CDemoLink m_DemoLink;
CDemoLink m_DemoPetzold;
CDemoLink m_DemoDilascia;
};
CAboutDlg::CAboutDlg() : CHyperLinkDlg(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CHyperLinkDlg)
//{{AFX_MSG_MAP(CAboutDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CCloverApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CCloverApp message handlers
BOOL CAboutDlg::OnInitDialog()
{
CHyperLinkDlg::OnInitDialog();
// TODO: Add extra initialization here
HICON hIco = (HICON) LoadImage( AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDR_MAINFRAME),
IMAGE_ICON, 0, 0,
0 );
CStatic iconCtrl;
iconCtrl.Attach(GetDlgItem(IDC_STATIC_ICON)->m_hWnd);
LASTERRORDISPLAYR(::DestroyIcon(iconCtrl.SetIcon(hIco)));
iconCtrl.Detach();
setURL(m_DemoIcon,IDC_MYICON);
setURL(m_DemoLink,IDC_HOMEPAGE);
setURL(m_DemoMail,IDC_EMAIL);
setURL(m_DemoPetzold,IDC_PETZOLD);
setURL(m_DemoDilascia,IDC_DILASCIA);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
|
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.
I'm located in Montreal,Canada and I graduated in electrical engineering at
E.T.S.
Highly experienced C++ developer. I have been working 3 years at Nortel Networks on their Next-gen OC-768 products firmware. I then worked for the FAA 3 years on their next-gen Oceanic Air Traffic Control system. Followed by a short period in the video game industry at Quazal, the online multiplayer middleware provider and now I am in the Internet audio/video streaming business at
StreamTheWorld.
To contact me, visit my
website