/
AboutDlg.cpp
140 lines (114 loc) · 3.55 KB
/
AboutDlg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
// AboutDlg.cpp : インプリメンテーション ファイル
//
#include "jbooklet.h"
#include "AboutDlg.h"
extern "C" {
#include "xmlRPC.h"
}
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#if (WINVER >= 0x0500)
//#define IDC_HAND MAKEINTRESOURCE(32649)
#ifdef IDC_HAND
#undef IDC_HAND
#endif
#endif /* WINVER >= 0x0500 */
#define IDC_HAND IDC_HAND2
/////////////////////////////////////////////////////////////////////////////
// アプリケーションのバージョン情報で使われている CAboutDlg ダイアログ
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
m_hCursor = AfxGetApp()->LoadCursor( IDC_HAND );
}
CAboutDlg::~CAboutDlg()
{
m_cFont.DeleteObject();
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
ON_BN_CLICKED(IDC_JBOOKLET_MAIL_ADDR, OnJbookletMailAddr)
ON_BN_CLICKED(IDC_JBOOKLET_WEB_URL, OnJbookletWebUrl)
ON_WM_SETCURSOR()
ON_WM_SHOWWINDOW()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CAboutDlg::OnJbookletMailAddr()
{
CString cmd;
cmd.LoadString( IDS_JBOOKLET_MAIL_ADDR );
ShellExecute( NULL, "open", cmd, NULL, NULL, SW_SHOWNORMAL );
}
void CAboutDlg::OnJbookletWebUrl()
{
CString cmd;
cmd.LoadString( IDS_JBOOKLET_WEB_URL );
ShellExecute( NULL, "open", cmd, NULL, NULL, SW_SHOWNORMAL );
}
BOOL CAboutDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
if ( nHitTest == HTCLIENT ) {
// Web の URLかメールアドレスにマウスポインタが来たら、
// 指カーソルを表示する
DWORD dwPos = GetMessagePos();
WORD wX = LOWORD( dwPos );
WORD wY = HIWORD( dwPos );
CPoint poCursor( wX, wY );
CRect rcClient;
CStatic *s = (CStatic *)GetDlgItem( IDC_JBOOKLET_MAIL_ADDR );
s->GetWindowRect( &rcClient );
if ( (wX >= rcClient.left) && (wX <= rcClient.right) &&
(wY >= rcClient.top) && (wY <= rcClient.bottom) ) {
SetCursor( m_hCursor );
return TRUE;
}
s = (CStatic *)GetDlgItem( IDC_JBOOKLET_WEB_URL );
s->GetWindowRect( &rcClient );
if ( (wX >= rcClient.left) && (wX <= rcClient.right) &&
(wY >= rcClient.top) && (wY <= rcClient.bottom) ) {
SetCursor( m_hCursor );
return TRUE;
}
}
return CDialog::OnSetCursor(pWnd, nHitTest, message);
}
void CAboutDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);
if ( bShow ) {
// Web の URLとメールアドレスを下線付きで表示する
LOGFONT tLogFont;
CFont *cWndFont;
cWndFont = GetFont();
cWndFont->GetLogFont( &tLogFont );
tLogFont.lfUnderline = 1;
m_cFont.CreateFontIndirect( &tLogFont );
CStatic *s = (CStatic *)GetDlgItem( IDC_JBOOKLET_MAIL_ADDR );
s->SetFont( &m_cFont, TRUE );
s = (CStatic *)GetDlgItem( IDC_JBOOKLET_WEB_URL );
s->SetFont( &m_cFont, TRUE );
CString str;
str.LoadString( IDS_JBOOKLET_VERSION );
str = "JBOOKlet Version " + str;
s = (CStatic *)GetDlgItem( IDC_JBOOKLET_VERSION );
s->SetWindowText( str );
// OpenSSL 版数表示
char buf[BUFSIZ];
size_t sz = BUFSIZ;
s = (CStatic *)GetDlgItem( IDC_OPENSSL );
s->SetWindowText( getOpenSSLversion( buf, sz ) );
// iconv 版数表示
s = (CStatic *)GetDlgItem( IDC_ICONV );
s->SetWindowText( getIconvVersion( buf, sz ) );
}
}