1 |
/* Tera Term |
2 |
Copyright(C) 1994-1998 T. Teranishi |
3 |
All rights reserved. */ |
4 |
|
5 |
/* TTMACRO.EXE, error dialog box */ |
6 |
|
7 |
#include "stdafx.h" |
8 |
#include "teraterm.h" |
9 |
#include "ttlib.h" |
10 |
#include "ttm_res.h" |
11 |
|
12 |
#include "errdlg.h" |
13 |
#include "ttmlib.h" |
14 |
|
15 |
#ifdef _DEBUG |
16 |
#define new DEBUG_NEW |
17 |
#undef THIS_FILE |
18 |
static char THIS_FILE[] = __FILE__; |
19 |
#endif |
20 |
|
21 |
// CErrDlg dialog |
22 |
CErrDlg::CErrDlg(PCHAR Msg, PCHAR Line, int x, int y) |
23 |
: CDialog(CErrDlg::IDD) |
24 |
{ |
25 |
//{{AFX_DATA_INIT(CErrDlg) |
26 |
//}}AFX_DATA_INIT |
27 |
MsgStr = Msg; |
28 |
LineStr = Line; |
29 |
PosX = x; |
30 |
PosY = y; |
31 |
} |
32 |
|
33 |
BEGIN_MESSAGE_MAP(CErrDlg, CDialog) |
34 |
//{{AFX_MSG_MAP(CErrDlg) |
35 |
//}}AFX_MSG_MAP |
36 |
END_MESSAGE_MAP() |
37 |
|
38 |
// CErrDlg message handler |
39 |
|
40 |
BOOL CErrDlg::OnInitDialog() |
41 |
{ |
42 |
RECT R; |
43 |
HDC TmpDC; |
44 |
char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG]; |
45 |
LOGFONT logfont; |
46 |
HFONT font; |
47 |
|
48 |
CDialog::OnInitDialog(); |
49 |
font = (HFONT)SendMessage(WM_GETFONT, 0, 0); |
50 |
GetObject(font, sizeof(LOGFONT), &logfont); |
51 |
if (get_lang_font("DLG_SYSTEM_FONT", m_hWnd, &logfont, &DlgFont, UILanguageFile)) { |
52 |
SendDlgItemMessage(IDC_ERRMSG, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0)); |
53 |
SendDlgItemMessage(IDC_ERRLINE, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0)); |
54 |
SendDlgItemMessage(IDOK, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0)); |
55 |
SendDlgItemMessage(IDCANCEL, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0)); |
56 |
} |
57 |
|
58 |
GetDlgItemText(IDOK, uimsg2, sizeof(uimsg2)); |
59 |
get_lang_msg("BTN_STOP", uimsg, sizeof(uimsg), uimsg2, UILanguageFile); |
60 |
SetDlgItemText(IDOK, uimsg); |
61 |
GetDlgItemText(IDCANCEL, uimsg2, sizeof(uimsg2)); |
62 |
get_lang_msg("BTN_CONTINUE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile); |
63 |
SetDlgItemText(IDCANCEL, uimsg); |
64 |
|
65 |
SetDlgItemText(IDC_ERRMSG,MsgStr); |
66 |
SetDlgItemText(IDC_ERRLINE,LineStr); |
67 |
|
68 |
if (PosX<=-100) { |
69 |
GetWindowRect(&R); |
70 |
TmpDC = ::GetDC(GetSafeHwnd()); |
71 |
PosX = (GetDeviceCaps(TmpDC,HORZRES)-R.right+R.left) / 2; |
72 |
PosY = (GetDeviceCaps(TmpDC,VERTRES)-R.bottom+R.top) / 2; |
73 |
::ReleaseDC(GetSafeHwnd(),TmpDC); |
74 |
} |
75 |
SetWindowPos(&wndTop,PosX,PosY,0,0,SWP_NOSIZE); |
76 |
SetForegroundWindow(); |
77 |
|
78 |
return TRUE; |
79 |
} |