/[H6]/h6-udlånssystemDlg.cpp
ViewVC logotype

Contents of /h6-udlånssystemDlg.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3 - (show annotations) (download)
Wed Aug 30 06:41:56 2006 UTC (17 years, 7 months ago) by torben
File size: 3483 byte(s)
Added an about box
1 // h6-udlånssystemDlg.cpp : implementation file
2 //
3
4 #include "stdafx.h"
5 #include "h6-udlånssystem.h"
6 #include "h6-udlånssystemDlg.h"
7 #include ".\h6-udlånssystemdlg.h"
8
9 #ifdef _DEBUG
10 #define new DEBUG_NEW
11 #endif
12
13
14 // CAboutDlg dialog used for App About
15
16 class CAboutDlg : public CDialog
17 {
18 public:
19 CAboutDlg();
20
21 // Dialog Data
22 enum { IDD = IDD_ABOUTBOX };
23
24 protected:
25 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
26
27 // Implementation
28 protected:
29 DECLARE_MESSAGE_MAP()
30 };
31
32 CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
33 {
34 }
35
36 void CAboutDlg::DoDataExchange(CDataExchange* pDX)
37 {
38 CDialog::DoDataExchange(pDX);
39 }
40
41 BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
42 END_MESSAGE_MAP()
43
44
45 // Ch6udlnssystemDlg dialog
46
47
48
49 Ch6udlnssystemDlg::Ch6udlnssystemDlg(CWnd* pParent /*=NULL*/)
50 : CDialog(Ch6udlnssystemDlg::IDD, pParent)
51 {
52 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
53 }
54
55 void Ch6udlnssystemDlg::DoDataExchange(CDataExchange* pDX)
56 {
57 CDialog::DoDataExchange(pDX);
58 }
59
60 BEGIN_MESSAGE_MAP(Ch6udlnssystemDlg, CDialog)
61 ON_WM_SYSCOMMAND()
62 ON_WM_PAINT()
63 ON_WM_QUERYDRAGICON()
64 //}}AFX_MSG_MAP
65 ON_COMMAND(ID_HELP_ABOUT, OnHelpAbout)
66 END_MESSAGE_MAP()
67
68
69 // Ch6udlnssystemDlg message handlers
70
71 BOOL Ch6udlnssystemDlg::OnInitDialog()
72 {
73 CDialog::OnInitDialog();
74
75 // Add "About..." menu item to system menu.
76
77 // IDM_ABOUTBOX must be in the system command range.
78 ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
79 ASSERT(IDM_ABOUTBOX < 0xF000);
80
81 CMenu* pSysMenu = GetSystemMenu(FALSE);
82 if (pSysMenu != NULL)
83 {
84 CString strAboutMenu;
85 strAboutMenu.LoadString(IDS_ABOUTBOX);
86 if (!strAboutMenu.IsEmpty())
87 {
88 pSysMenu->AppendMenu(MF_SEPARATOR);
89 pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
90 }
91 }
92
93 // Set the icon for this dialog. The framework does this automatically
94 // when the application's main window is not a dialog
95 SetIcon(m_hIcon, TRUE); // Set big icon
96 SetIcon(m_hIcon, FALSE); // Set small icon
97
98 // TODO: Add extra initialization here
99
100 return TRUE; // return TRUE unless you set the focus to a control
101 }
102
103 void Ch6udlnssystemDlg::OnSysCommand(UINT nID, LPARAM lParam)
104 {
105 if ((nID & 0xFFF0) == IDM_ABOUTBOX)
106 {
107 CAboutDlg dlgAbout;
108 dlgAbout.DoModal();
109 }
110 else
111 {
112 CDialog::OnSysCommand(nID, lParam);
113 }
114 }
115
116 // If you add a minimize button to your dialog, you will need the code below
117 // to draw the icon. For MFC applications using the document/view model,
118 // this is automatically done for you by the framework.
119
120 void Ch6udlnssystemDlg::OnPaint()
121 {
122 if (IsIconic())
123 {
124 CPaintDC dc(this); // device context for painting
125
126 SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
127
128 // Center icon in client rectangle
129 int cxIcon = GetSystemMetrics(SM_CXICON);
130 int cyIcon = GetSystemMetrics(SM_CYICON);
131 CRect rect;
132 GetClientRect(&rect);
133 int x = (rect.Width() - cxIcon + 1) / 2;
134 int y = (rect.Height() - cyIcon + 1) / 2;
135
136 // Draw the icon
137 dc.DrawIcon(x, y, m_hIcon);
138 }
139 else
140 {
141 CDialog::OnPaint();
142 }
143 }
144
145 // The system calls this function to obtain the cursor to display while the user drags
146 // the minimized window.
147 HCURSOR Ch6udlnssystemDlg::OnQueryDragIcon()
148 {
149 return static_cast<HCURSOR>(m_hIcon);
150 }
151
152 void Ch6udlnssystemDlg::OnHelpAbout()
153 {
154 MessageBox("DA6H :: Udlånssystem\r\nLavet af:\r\nKevin, Hedin & Torben");
155 }

  ViewVC Help
Powered by ViewVC 1.1.20