1 |
/* Tera Term |
/* Tera Term |
2 |
Copyright(C) 1994-1998 T. Teranishi |
Copyright(C) 1994-1998 T. Teranishi |
3 |
All rights reserved. */ |
All rights reserved. */ |
4 |
|
|
5 |
/* TTMACRO.EXE, main */ |
/* TTMACRO.EXE, main */ |
6 |
|
|
7 |
#include "stdafx.h" |
#include "stdafx.h" |
8 |
#include "teraterm.h" |
#include "teraterm.h" |
9 |
#include "ttm_res.h" |
#include "ttm_res.h" |
10 |
#include "ttmmain.h" |
#include "ttmmain.h" |
11 |
#include "ttl.h" |
#include "ttl.h" |
12 |
|
|
13 |
#include "ttmacro.h" |
#include "ttmacro.h" |
14 |
#include "ttmlib.h" |
#include "ttmlib.h" |
15 |
#include "ttlib.h" |
#include "ttlib.h" |
16 |
|
|
17 |
#include "compat_w95.h" |
#include "compat_w95.h" |
18 |
|
|
19 |
#ifdef _DEBUG |
#ifdef _DEBUG |
20 |
#define new DEBUG_NEW |
#define new DEBUG_NEW |
21 |
#undef THIS_FILE |
#undef THIS_FILE |
22 |
static char THIS_FILE[] = __FILE__; |
static char THIS_FILE[] = __FILE__; |
23 |
#endif |
#endif |
24 |
|
|
25 |
char UILanguageFile[MAX_PATH]; |
char UILanguageFile[MAX_PATH]; |
26 |
|
|
27 |
///////////////////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////////////////// |
28 |
|
|
29 |
BEGIN_MESSAGE_MAP(CCtrlApp, CWinApp) |
BEGIN_MESSAGE_MAP(CCtrlApp, CWinApp) |
30 |
//{{AFX_MSG_MAP(CCtrlApp) |
//{{AFX_MSG_MAP(CCtrlApp) |
31 |
//}}AFX_MSG |
//}}AFX_MSG |
32 |
END_MESSAGE_MAP() |
END_MESSAGE_MAP() |
33 |
|
|
34 |
///////////////////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////////////////// |
35 |
|
|
36 |
CCtrlApp::CCtrlApp() |
CCtrlApp::CCtrlApp() |
37 |
{ |
{ |
38 |
} |
} |
39 |
|
|
40 |
///////////////////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////////////////// |
41 |
|
|
42 |
CCtrlApp theApp; |
CCtrlApp theApp; |
43 |
|
|
44 |
///////////////////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////////////////// |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
BOOL CCtrlApp::InitInstance() |
BOOL CCtrlApp::InitInstance() |
49 |
{ |
{ |
50 |
static HMODULE HTTSET = NULL; |
static HMODULE HTTSET = NULL; |
51 |
|
|
52 |
// インストーラで実行を検出するために mutex を作成する (2006.8.12 maya) |
// インストーラで実行を検出するために mutex を作成する (2006.8.12 maya) |
53 |
// 2重起動防止のためではないので、特に返り値は見ない |
// 2重起動防止のためではないので、特に返り値は見ない |
54 |
HANDLE hMutex; |
HANDLE hMutex; |
55 |
hMutex = CreateMutex(NULL, TRUE, "TeraTermProMacroAppMutex"); |
hMutex = CreateMutex(NULL, TRUE, "TeraTermProMacroAppMutex"); |
56 |
|
|
57 |
GetUILanguageFile(UILanguageFile, sizeof(UILanguageFile)); |
GetUILanguageFile(UILanguageFile, sizeof(UILanguageFile)); |
58 |
|
|
59 |
Busy = TRUE; |
Busy = TRUE; |
60 |
m_pMainWnd = new CCtrlWindow(); |
m_pMainWnd = new CCtrlWindow(); |
61 |
PCtrlWindow(m_pMainWnd)->Create(); |
PCtrlWindow(m_pMainWnd)->Create(); |
62 |
Busy = FALSE; |
Busy = FALSE; |
63 |
return TRUE; |
return TRUE; |
64 |
} |
} |
65 |
|
|
66 |
int CCtrlApp::ExitInstance() |
int CCtrlApp::ExitInstance() |
67 |
{ |
{ |
68 |
m_pMainWnd = NULL; |
m_pMainWnd = NULL; |
69 |
return ExitCode; |
return ExitCode; |
70 |
} |
} |
71 |
|
|
72 |
// TTMACRO main engine |
// TTMACRO main engine |
73 |
BOOL CCtrlApp::OnIdle(LONG lCount) |
BOOL CCtrlApp::OnIdle(LONG lCount) |
74 |
{ |
{ |
75 |
BOOL Continue; |
BOOL Continue; |
76 |
|
|
77 |
// Avoid multi entry |
// Avoid multi entry |
78 |
if (Busy) { |
if (Busy) { |
79 |
return FALSE; |
return FALSE; |
80 |
} |
} |
81 |
Busy = TRUE; |
Busy = TRUE; |
82 |
if (m_pMainWnd != NULL) { |
if (m_pMainWnd != NULL) { |
83 |
Continue = PCtrlWindow(m_pMainWnd)->OnIdle(); |
Continue = PCtrlWindow(m_pMainWnd)->OnIdle(); |
84 |
} |
} |
85 |
else { |
else { |
86 |
Continue = FALSE; |
Continue = FALSE; |
87 |
} |
} |
88 |
Busy = FALSE; |
Busy = FALSE; |
89 |
return Continue; |
return Continue; |
90 |
} |
} |