-
Notifications
You must be signed in to change notification settings - Fork 0
/
ttpmenu.cpp
2735 lines (2429 loc) · 93.9 KB
/
ttpmenu.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* ==========================================================================
Project Name : TeraTerm Menu
Outline : TeraTerm Menu Function
Version : 0.94
Create : 1998-11-22(Sun)
Update : 2002-10-02(Wed)
Reference : Copyright (C) S.Hayakawa 1997-2002
======1=========2=========3=========4=========5=========6=========7======= */
#define STRICT
#include <windows.h>
#include <commctrl.h>
#include <windowsx.h> // for GET_X_LPARAM(), GET_Y_LPARAM()
#include "ttpmenu.h"
#include "registry.h"
#include "winmisc.h"
#include "resource.h"
#include "compat_w95.h"
// UTF-8 TeraTermでは、デフォルトインストール先を下記に変更した。(2004.12.2 yutaka)
// さらに、デフォルトインストール先はカレントディレクトリに変更。(2004.12.14 yutaka)
#define DEFAULT_PATH "."
// グローバル変数
HWND g_hWnd; // メインのハンドル
HWND g_hWndMenu = NULL; // 設定ダイアログのハンドル
HWND g_hWndTip; // 設定ダイアログ内ツールチップのハンドル
HICON g_hIcon; // アプリケーションアイコンのハンドル
HICON g_hIconSmall; // アプリケーションアイコン(16x16)のハンドル
HMENU g_hMenu; // メニュー(非表示)のハンドル
HMENU g_hSubMenu; // ポップアップメニューのハンドル
HMENU g_hListMenu; // 設定一覧ポップアップメニューのハンドル
HMENU g_hConfigMenu; // 表示設定ポップアップメニューのハンドル
HHOOK g_hHook = NULL; // ツールチップ関連フックのハンドル
HINSTANCE g_hI; // アプリケーションインスタンス
JobInfo g_JobInfo; // カレントの設定情報構造体(設定ダイアログ)
MenuData g_MenuData; // TeraTerm Menuの表示設定等の構造体
char UILanguageFile[MAX_PATH];
HFONT g_AboutFont;
HFONT g_ConfigFont;
HFONT g_DetailFont;
// ttdlg.c と同じ内容
// 実行ファイルからバージョン情報を得る (2005.2.28 yutaka)
void get_file_version(char *exefile, int *major, int *minor, int *release, int *build)
{
typedef struct {
WORD wLanguage;
WORD wCodePage;
} LANGANDCODEPAGE, *LPLANGANDCODEPAGE;
LPLANGANDCODEPAGE lplgcode;
UINT unLen;
DWORD size;
char *buf = NULL;
BOOL ret;
int i;
char fmt[80];
char *pbuf;
size = GetFileVersionInfoSize(exefile, NULL);
if (size == 0) {
goto error;
}
buf = (char *)malloc(size);
ZeroMemory(buf, size);
if (GetFileVersionInfo(exefile, 0, size, buf) == FALSE) {
goto error;
}
ret = VerQueryValue(buf,
"\\VarFileInfo\\Translation",
(LPVOID *)&lplgcode, &unLen);
if (ret == FALSE)
goto error;
for (i = 0 ; i < (int)(unLen / sizeof(LANGANDCODEPAGE)) ; i++) {
_snprintf(fmt, sizeof(fmt), "\\StringFileInfo\\%04x%04x\\FileVersion",
lplgcode[i].wLanguage, lplgcode[i].wCodePage);
VerQueryValue(buf, fmt, (LPVOID *)&pbuf, &unLen);
if (unLen > 0) { // get success
int n, a, b, c, d;
n = sscanf(pbuf, "%d, %d, %d, %d", &a, &b, &c, &d);
if (n == 4) { // convert success
*major = a;
*minor = b;
*release = c;
*build = d;
break;
}
}
}
free(buf);
return;
error:
free(buf);
*major = *minor = *release = *build = 0;
}
/* ==========================================================================
Function Name : (BOOL) ExecStartup()
Outline : スタートアップ設定のジョブを実行する。
Arguments : HWND hWnd (In) ダイアログのハンドル
Return Value : 成功 TRUE
Reference :
Renewal :
Notes :
Attention :
Up Date :
======1=========2=========3=========4=========5=========6=========7======= */
BOOL ExecStartup(HWND hWnd)
{
char szEntryName[MAX_PATH];
char szJobName[MAXJOBNUM][MAX_PATH];
HKEY hKey;
DWORD dwCnt;
DWORD dwIndex = 0;
DWORD dwSize = MAX_PATH;
if ((hKey = RegOpen(HKEY_CURRENT_USER, TTERM_KEY)) != INVALID_HANDLE_VALUE) {
while (RegEnumEx(hKey, dwIndex, szEntryName, &dwSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) {
::lstrcpy(szJobName[dwIndex++], szEntryName);
dwSize = MAX_PATH;
}
::lstrcpy(szJobName[dwIndex], "");
RegClose(hKey);
for (dwCnt = 0; dwCnt < dwIndex; dwCnt++)
ConnectHost(hWnd, 0, szJobName[dwCnt]);
}
return TRUE;
}
/* ==========================================================================
Function Name : (BOOL) ErrorMessage()
Outline : 指定メッセージ+システムのエラーメッセージを表示する。
Arguments : HWND hWnd (In) 親ウインドウのハンドル
: LPTSTR msg,... (In) 任意メッセージ文字列
Return Value : 成功 TRUE
Reference :
Renewal :
Notes :
Attention :
Up Date :
======1=========2=========3=========4=========5=========6=========7======= */
BOOL ErrorMessage(HWND hWnd, DWORD dwErr, LPTSTR msg,...)
{
char szBuffer[MAX_PATH] = "";
va_list ap;
va_start(ap, msg);
vsprintf(szBuffer + ::lstrlen(szBuffer), msg, ap);
va_end(ap);
::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dwErr,
LANG_NEUTRAL,
szBuffer + ::lstrlen(szBuffer),
MAX_PATH,
NULL);
MessageBox(hWnd, szBuffer, "TeraTerm Menu", MB_ICONSTOP | MB_OK);
return TRUE;
}
/* ==========================================================================
Function Name : (BOOL) SetMenuFont()
Outline : フォント指定ダイアログを表示し、指定されたフォントを
: 設定する。
Arguments : HWND hWnd (In) 親ウインドウのハンドル
Return Value : 成功 TRUE
Reference :
Renewal :
Notes :
Attention :
Up Date :
======1=========2=========3=========4=========5=========6=========7======= */
BOOL SetMenuFont(HWND hWnd)
{
HWND hFontWnd;
DWORD rgbColors;
LOGFONT lfFont;
CHOOSEFONT chooseFont;
static int open = 0;
if (open == 1) {
while ((hFontWnd = ::FindWindow(NULL, "Font")) != NULL) {
if (hWnd == ::GetParent(hFontWnd)) {
::SetForceForegroundWindow(hFontWnd);
break;
}
}
return TRUE;
}
open = 1;
lfFont = g_MenuData.lfFont;
rgbColors = g_MenuData.crMenuTxt;
memset((void *) &chooseFont, 0, sizeof(CHOOSEFONT));
chooseFont.lStructSize = sizeof(CHOOSEFONT);
chooseFont.hwndOwner = hWnd;
chooseFont.lpLogFont = &lfFont;
chooseFont.Flags = CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT | CF_EFFECTS;
chooseFont.rgbColors = rgbColors;
chooseFont.nFontType = SCREEN_FONTTYPE;
if (::ChooseFont(&chooseFont) == TRUE) {
if (g_MenuData.hFont != NULL)
::DeleteObject((HGDIOBJ) g_MenuData.hFont);
g_MenuData.crMenuTxt = chooseFont.rgbColors;
g_MenuData.lfFont = lfFont;
g_MenuData.hFont = ::CreateFontIndirect(&lfFont);
RedrawMenu(hWnd);
}
open = 0;
return TRUE;
}
/* ==========================================================================
Function Name : (BOOL) ExtractAssociatedIconEx()
Outline : アプリケーションに関連付けられたアイコンを取得する。
: 設定する。
Arguments : char *szPath (In) アプリケーション名
: HICON *hLargeIcon (Out) 大きいアイコンのハンドル
: HICON *hSmallIcon (Out) 小さいアイコンのハンドル
Return Value : 成功 TRUE
Reference :
Renewal :
Notes :
Attention :
Up Date :
======1=========2=========3=========4=========5=========6=========7======= */
BOOL ExtractAssociatedIconEx(char *szPath, HICON *hLargeIcon, HICON *hSmallIcon)
{
SHFILEINFO sfi;
::SHGetFileInfo(szPath, 0, &sfi, sizeof(sfi), SHGFI_LARGEICON | SHGFI_ICON);
*hLargeIcon = ::CopyIcon(sfi.hIcon);
::DestroyIcon(sfi.hIcon);
::SHGetFileInfo(szPath, 0, &sfi, sizeof(sfi), SHGFI_SMALLICON | SHGFI_ICON);
*hSmallIcon = ::CopyIcon(sfi.hIcon);
::DestroyIcon(sfi.hIcon);
return TRUE;
}
/* ==========================================================================
Function Name : (BOOL) GetApplicationFilename()
Outline : レジストリより指定された設定のアプロケーション名を取得
: する。
Arguments : char *szName (In) 設定名
: char *szPath (Out) アプリケーション名
Return Value : 成功 TRUE
Reference :
Renewal :
Notes :
Attention :
Up Date :
======1=========2=========3=========4=========5=========6=========7======= */
BOOL GetApplicationFilename(char *szName, char *szPath)
{
char szSubKey[MAX_PATH];
char szDefault[MAX_PATH] = DEFAULT_PATH;
char szTTermPath[MAX_PATH];
BOOL bRet;
BOOL bTtssh = FALSE;
HKEY hKey;
::wsprintf(szSubKey, "%s\\%s", TTERM_KEY, szName);
if ((hKey = RegOpen(HKEY_CURRENT_USER, szSubKey)) == INVALID_HANDLE_VALUE)
return FALSE;
bRet = RegGetStr(hKey, KEY_TERATERM, szPath, MAX_PATH);
if (bRet == FALSE || ::lstrlen(szPath) == 0) {
RegGetDword(hKey, KEY_TTSSH, (LPDWORD) &bTtssh);
::GetProfileString("Tera Term Pro", "Path", szDefault, szTTermPath, MAX_PATH);
::wsprintf(szPath, "%s\\%s", szTTermPath, bTtssh ? TTSSH : TERATERM);
}
RegClose(hKey);
return TRUE;
}
/* ==========================================================================
Function Name : (BOOL) AddTooltip()
Outline : 指定されたコントロールにツールチップを関連付ける
Arguments : int idControl (In) コントロールID
Return Value : 成功 TRUE / 失敗 FALSE
Reference :
Renewal :
Notes :
Attention :
Up Date :
======1=========2=========3=========4=========5=========6=========7======= */
BOOL AddTooltip(int idControl)
{
TOOLINFO ti;
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_IDISHWND;
ti.hwnd = g_hWndMenu;
ti.uId = (UINT) ::GetDlgItem(g_hWndMenu, idControl);
ti.hinst = 0;
ti.lpszText = LPSTR_TEXTCALLBACK;
return ::SendMessage(g_hWndTip, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
}
/* ==========================================================================
Function Name : (BOOL) LoadConfig()
Outline : レジストリよりTeraTerm Menuの表示設定等を取得する
Arguments : なし
Return Value : 成功 TRUE / 失敗 FALSE
Reference :
Renewal :
Notes :
Attention :
Up Date :
======1=========2=========3=========4=========5=========6=========7======= */
BOOL LoadConfig(void)
{
HKEY hKey;
char uimsg[MAX_UIMSG];
if ((hKey = RegCreate(HKEY_CURRENT_USER, TTERM_KEY)) == INVALID_HANDLE_VALUE)
return FALSE;
if (RegGetDword(hKey, KEY_ICONMODE, &(g_MenuData.dwIconMode)) == TRUE) {
if (g_MenuData.dwIconMode == MODE_LARGEICON) {
UTIL_get_lang_msg("MENU_ICON", uimsg, sizeof(uimsg), STR_ICONMODE, UILanguageFile);
::ModifyMenu(g_hConfigMenu, ID_ICON, MF_CHECKED | MF_BYCOMMAND, ID_ICON, uimsg);
}
} else
g_MenuData.dwIconMode = MODE_SMALLICON;
if (RegGetDword(hKey, KEY_LEFTBUTTONPOPUP, (LPDWORD) &(g_MenuData.bLeftButtonPopup)) == FALSE)
g_MenuData.bLeftButtonPopup = TRUE;
if (g_MenuData.bLeftButtonPopup == TRUE) {
UTIL_get_lang_msg("MENU_LEFTPOPUP", uimsg, sizeof(uimsg), STR_LEFTBUTTONPOPUP, UILanguageFile);
::ModifyMenu(g_hConfigMenu, ID_LEFTPOPUP, MF_CHECKED | MF_BYCOMMAND, ID_LEFTPOPUP, uimsg);
}
if (RegGetDword(hKey, KEY_MENUTEXTCOLOR, &(g_MenuData.crMenuTxt)) == FALSE)
g_MenuData.crMenuTxt = ::GetSysColor(COLOR_MENUTEXT);
if (RegGetDword(hKey, KEY_HOTKEY, (LPDWORD) &(g_MenuData.bHotkey)) == FALSE)
g_MenuData.bHotkey = FALSE;
if (g_MenuData.bHotkey == TRUE) {
UTIL_get_lang_msg("MENU_HOTKEY", uimsg, sizeof(uimsg), STR_HOTKEY, UILanguageFile);
::ModifyMenu(g_hConfigMenu, ID_HOTKEY, MF_CHECKED | MF_BYCOMMAND, ID_HOTKEY, uimsg);
::RegisterHotKey(g_hWnd, WM_MENUOPEN, MOD_CONTROL | MOD_ALT, 'M');
}
if (RegGetDword(hKey, KEY_LF_HEIGHT, (DWORD *) &(g_MenuData.lfFont.lfHeight)) == TRUE) {
RegGetDword(hKey, KEY_LF_WIDTH, (DWORD *) &(g_MenuData.lfFont.lfWidth));
RegGetDword(hKey, KEY_LF_ESCAPEMENT, (DWORD *) &(g_MenuData.lfFont.lfEscapement));
RegGetDword(hKey, KEY_LF_ORIENTATION, (DWORD *) &(g_MenuData.lfFont.lfOrientation));
RegGetDword(hKey, KEY_LF_WEIGHT, (DWORD *) &(g_MenuData.lfFont.lfWeight));
RegGetDword(hKey, KEY_LF_ITALIC, (DWORD *) &(g_MenuData.lfFont.lfItalic));
RegGetDword(hKey, KEY_LF_UNDERLINE, (DWORD *) &(g_MenuData.lfFont.lfUnderline));
RegGetDword(hKey, KEY_LF_STRIKEOUT, (DWORD *) &(g_MenuData.lfFont.lfStrikeOut));
RegGetDword(hKey, KEY_LF_CHARSET, (DWORD *) &(g_MenuData.lfFont.lfCharSet));
RegGetDword(hKey, KEY_LF_OUTPRECISION, (DWORD *) &(g_MenuData.lfFont.lfOutPrecision));
RegGetDword(hKey, KEY_LF_CLIPPRECISION, (DWORD *) &(g_MenuData.lfFont.lfClipPrecision));
RegGetDword(hKey, KEY_LF_QUALITY, (DWORD *) &(g_MenuData.lfFont.lfQuality));
RegGetDword(hKey, KEY_LF_PITCHANDFAMILY, (DWORD *) &(g_MenuData.lfFont.lfPitchAndFamily));
RegGetStr(hKey, KEY_LF_FACENAME, g_MenuData.lfFont.lfFaceName, LF_FACESIZE);
} else
::GetObject(::GetStockObject(DEFAULT_GUI_FONT), sizeof(LOGFONT), &(g_MenuData.lfFont));
RegClose(hKey);
g_MenuData.crMenuBg = ::GetSysColor(COLOR_MENU);
g_MenuData.crSelMenuBg = ::GetSysColor(COLOR_HIGHLIGHT);
g_MenuData.crSelMenuTxt = ::GetSysColor(COLOR_HIGHLIGHTTEXT);
g_MenuData.hFont = ::CreateFontIndirect(&(g_MenuData.lfFont));
return TRUE;
}
/* ==========================================================================
Function Name : (BOOL) SaveConfig()
Outline : レジストリにTeraTerm Menuの表示設定等を保存する
Arguments : なし
Return Value : 成功 TRUE / 失敗 FALSE
Reference :
Renewal :
Notes :
Attention :
Up Date :
======1=========2=========3=========4=========5=========6=========7======= */
BOOL SaveConfig(void)
{
HKEY hKey;
if ((hKey = RegOpen(HKEY_CURRENT_USER, TTERM_KEY)) == INVALID_HANDLE_VALUE)
return FALSE;
RegSetDword(hKey, KEY_ICONMODE, g_MenuData.dwIconMode);
RegSetDword(hKey, KEY_LEFTBUTTONPOPUP, g_MenuData.bLeftButtonPopup);
RegSetDword(hKey, KEY_HOTKEY, g_MenuData.bHotkey);
RegSetDword(hKey, KEY_MENUTEXTCOLOR, g_MenuData.crMenuTxt);
RegSetDword(hKey, KEY_LF_HEIGHT, g_MenuData.lfFont.lfHeight);
RegSetDword(hKey, KEY_LF_WIDTH, g_MenuData.lfFont.lfWidth);
RegSetDword(hKey, KEY_LF_ESCAPEMENT, g_MenuData.lfFont.lfEscapement);
RegSetDword(hKey, KEY_LF_ORIENTATION, g_MenuData.lfFont.lfOrientation);
RegSetDword(hKey, KEY_LF_WEIGHT, g_MenuData.lfFont.lfWeight);
RegSetDword(hKey, KEY_LF_ITALIC, g_MenuData.lfFont.lfItalic);
RegSetDword(hKey, KEY_LF_UNDERLINE, g_MenuData.lfFont.lfUnderline);
RegSetDword(hKey, KEY_LF_STRIKEOUT, g_MenuData.lfFont.lfStrikeOut);
RegSetDword(hKey, KEY_LF_CHARSET, g_MenuData.lfFont.lfCharSet);
RegSetDword(hKey, KEY_LF_OUTPRECISION, g_MenuData.lfFont.lfOutPrecision);
RegSetDword(hKey, KEY_LF_CLIPPRECISION, g_MenuData.lfFont.lfClipPrecision);
RegSetDword(hKey, KEY_LF_QUALITY, g_MenuData.lfFont.lfQuality);
RegSetDword(hKey, KEY_LF_PITCHANDFAMILY, g_MenuData.lfFont.lfPitchAndFamily);
RegSetStr(hKey, KEY_LF_FACENAME, g_MenuData.lfFont.lfFaceName);
RegClose(hKey);
return TRUE;
}
/* ==========================================================================
Function Name : (LRESULT CALLBACK) GetMsgProc()
Outline : フック プロシージャ(GetMsgProcのヘルプ参照)
Arguments :
Return Value :
Reference :
Renewal :
Notes :
Attention :
Up Date :
======1=========2=========3=========4=========5=========6=========7======= */
LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam)
{
MSG *lpMsg;
lpMsg = (MSG *) lParam;
if (nCode < 0 || !(::IsChild(g_hWndMenu, lpMsg->hwnd)))
return ::CallNextHookEx(g_hHook, nCode, wParam, lParam);
switch (lpMsg->message) {
case WM_MOUSEMOVE:
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
if (g_hWndTip != NULL) {
MSG msg;
msg.lParam = lpMsg->lParam;
msg.wParam = lpMsg->wParam;
msg.message = lpMsg->message;
msg.hwnd = lpMsg->hwnd;
::SendMessage(g_hWndTip, TTM_RELAYEVENT, 0, (LPARAM) (LPMSG) &msg);
}
break;
default:
break;
}
return ::CallNextHookEx(g_hHook, nCode, wParam, lParam);
}
/* ==========================================================================
Function Name : (BOOL) CreateTooltip()
Outline : ツールチップを作成する
Arguments : なし
Return Value : 成功 TRUE / 失敗 FALSE
Reference :
Renewal :
Notes :
Attention :
Up Date :
======1=========2=========3=========4=========5=========6=========7======= */
BOOL CreateTooltip(void)
{
::InitCommonControls();
g_hWndTip = ::CreateWindowEx(0,
TOOLTIPS_CLASS,
(LPSTR) NULL,
TTS_ALWAYSTIP,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
g_hWndMenu,
(HMENU) NULL,
g_hI,
NULL);
if (g_hWndTip == NULL)
return FALSE;
AddTooltip(BUTTON_SET);
AddTooltip(BUTTON_DELETE);
AddTooltip(BUTTON_ETC);
AddTooltip(CHECK_TTSSH);
g_hHook = ::SetWindowsHookEx(WH_GETMESSAGE,
GetMsgProc,
(HINSTANCE) NULL,
::GetCurrentThreadId());
if (g_hHook == (HHOOK) NULL)
return FALSE;
return TRUE;
}
/* ==========================================================================
Function Name : (BOOL) ManageWMNotify_Config()
Outline : 設定ダイアログのWM_NOTIFYを処理する
Arguments : LPARAM lParam
Return Value : 処理 TRUE / 未処理 FALSE
Reference :
Renewal :
Notes :
Attention :
Up Date :
======1=========2=========3=========4=========5=========6=========7======= */
BOOL ManageWMNotify_Config(LPARAM lParam)
{
int idCtrl;
LPTOOLTIPTEXT lpttt;
if ((((LPNMHDR) lParam)->code) == TTN_NEEDTEXT) {
idCtrl = ::GetDlgCtrlID((HWND) ((LPNMHDR) lParam)->idFrom);
lpttt = (LPTOOLTIPTEXT) lParam;
switch (idCtrl) {
case BUTTON_SET:
lpttt->lpszText = "Regist";
return TRUE;
case BUTTON_DELETE:
lpttt->lpszText = "Delete";
return TRUE;
case BUTTON_ETC:
lpttt->lpszText = "Configure";
return TRUE;
case CHECK_TTSSH:
lpttt->lpszText = "use SSH";
return TRUE;
}
}
return FALSE;
}
/* ==========================================================================
Function Name : (void) PopupMenu()
Outline : メインのポップアップメニューを表示する。
Arguments : HWND hWnd (In) 親ウインドウのハンドル
Return Value : なし
Reference :
Renewal :
Notes :
Attention :
Up Date :
======1=========2=========3=========4=========5=========6=========7======= */
void PopupMenu(HWND hWnd)
{
POINT Point;
GetCursorPos(&Point);
::SetForceForegroundWindow(hWnd);
// マルチモニタ環境では LOWORD(), HIWORD() を使ってはいけない。(2005.10.13 yutaka)
::TrackPopupMenu(g_hSubMenu,
TPM_LEFTALIGN | TPM_RIGHTBUTTON,
Point.x,
Point.y,
0,
hWnd,
NULL);
}
/* ==========================================================================
Function Name : (void) PopupListMenu()
Outline : 設定一覧のポップアップメニューを表示する。
Arguments : HWND hWnd (In) 親ウインドウのハンドル
Return Value : なし
Reference :
Renewal :
Notes :
Attention :
Up Date :
======1=========2=========3=========4=========5=========6=========7======= */
void PopupListMenu(HWND hWnd)
{
POINT Point;
GetCursorPos(&Point);
::SetForceForegroundWindow(hWnd);
// マルチモニタ環境では LOWORD(), HIWORD() を使ってはいけない。(2005.10.13 yutaka)
::TrackPopupMenu(g_hListMenu,
TPM_LEFTALIGN | TPM_RIGHTBUTTON,
Point.x,
Point.y,
0,
hWnd,
NULL);
}
/* ==========================================================================
Function Name : (BOOL) InitListBox()
Outline : 設定ダイアログ内の設定一覧リストボックスを初期化する。
Arguments : HWND hWnd (In) ダイアログのハンドル
Return Value : 成功 TRUE
Reference :
Renewal :
Notes :
Attention :
Up Date :
======1=========2=========3=========4=========5=========6=========7======= */
BOOL InitListBox(HWND hWnd)
{
char szPath[MAX_PATH];
DWORD dwCnt = 0;
DWORD dwIndex = 0;
::SendDlgItemMessage(hWnd, LIST_HOST, LB_RESETCONTENT, 0, 0);
while (::lstrlen(g_MenuData.szName[dwIndex]) != 0) {
if (GetApplicationFilename(g_MenuData.szName[dwIndex], szPath) == TRUE) {
::SendDlgItemMessage(hWnd, LIST_HOST, LB_ADDSTRING, 0, (LPARAM)(LPCTSTR) g_MenuData.szName[dwIndex]);
::SendDlgItemMessage(hWnd, LIST_HOST, LB_SETITEMDATA, (WPARAM) dwCnt, (LPARAM) dwIndex);
dwCnt++;
}
dwIndex++;
}
return TRUE;
}
void init_password_control(HWND dlg, int item)
{
HWND passwordControl = GetDlgItem(dlg, item);
SetWindowLong(passwordControl, GWL_USERDATA,
SetWindowLong(passwordControl, GWL_WNDPROC,
(LONG) password_wnd_proc));
}
/* ==========================================================================
Function Name : (BOOL) InitConfigDlg()
Outline : 設定ダイアログを初期化する。
Arguments : HWND hWnd (In) ダイアログのハンドル
Return Value : 成功 TRUE
Reference :
Renewal :
Notes :
Attention :
Up Date :
======1=========2=========3=========4=========5=========6=========7======= */
BOOL InitConfigDlg(HWND hWnd)
{
HICON g_hIconLeft;
HICON g_hIconRight;
LOGFONT logfont;
HFONT font;
char uimsg[MAX_UIMSG], uitmp[MAX_UIMSG];
font = (HFONT)SendMessage(hWnd, WM_GETFONT, 0, 0);
GetObject(font, sizeof(LOGFONT), &logfont);
if (get_lang_font("DLG_TAHOMA_FONT", hWnd, &logfont, &g_ConfigFont, UILanguageFile)) {
SendDlgItemMessage(hWnd, LBL_LIST, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, LIST_HOST, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, GRP_CONFIG, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, LBL_ENTRY, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, EDIT_ENTRY, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, GRP_LAUNCH, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, RADIO_LOGIN, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, LBL_HOST, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, EDIT_HOST, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, CHECK_USER, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, EDIT_USER, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, CHECK_PASSWORD, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, EDIT_PASSWORD, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, RADIO_MACRO, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, EDIT_MACRO, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, BUTTON_MACRO, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, RADIO_DIRECT, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, BUTTON_ETC, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, CHECK_STARTUP, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, CHECK_TTSSH, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, IDC_KEYFILE_LABEL, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, IDC_KEYFILE_PATH, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, IDC_KEYFILE_BUTTON, WM_SETFONT, (WPARAM)g_ConfigFont, MAKELPARAM(TRUE,0));
}
else {
g_ConfigFont = NULL;
}
GetWindowText(hWnd, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_CONFIG_TITLE", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetWindowText(hWnd, uimsg);
GetDlgItemText(hWnd, LBL_LIST, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_CONFIG_ITEM", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, LBL_LIST, uimsg);
GetDlgItemText(hWnd, GRP_CONFIG, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_CONFIG_CONFIG", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, GRP_CONFIG, uimsg);
GetDlgItemText(hWnd, LBL_ENTRY, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_CONFIG_NAME", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, LBL_ENTRY, uimsg);
GetDlgItemText(hWnd, GRP_LAUNCH, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_CONFIG_PATTERN", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, GRP_LAUNCH, uimsg);
GetDlgItemText(hWnd, RADIO_LOGIN, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_CONFIG_AUTO", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, RADIO_LOGIN, uimsg);
GetDlgItemText(hWnd, LBL_HOST, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_CONFIG_HOST", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, LBL_HOST, uimsg);
GetDlgItemText(hWnd, CHECK_USER, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_CONFIG_USER", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, CHECK_USER, uimsg);
GetDlgItemText(hWnd, CHECK_PASSWORD, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_CONFIG_PASS", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, CHECK_PASSWORD, uimsg);
GetDlgItemText(hWnd, RADIO_MACRO, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_CONFIG_MACRO", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, RADIO_MACRO, uimsg);
GetDlgItemText(hWnd, RADIO_DIRECT, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_CONFIG_LAUNCH", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, RADIO_DIRECT, uimsg);
GetDlgItemText(hWnd, CHECK_STARTUP, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_CONFIG_STARTUP", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, CHECK_STARTUP, uimsg);
GetDlgItemText(hWnd, CHECK_TTSSH, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_CONFIG_SSH", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, CHECK_TTSSH, uimsg);
GetDlgItemText(hWnd, IDC_KEYFILE_LABEL, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_CONFIG_KEYFILE", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, IDC_KEYFILE_LABEL, uimsg);
GetDlgItemText(hWnd, IDC_CHALLENGE_CHECK, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_CONFIG_CHALLENGE", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, IDC_CHALLENGE_CHECK, uimsg);
GetDlgItemText(hWnd, IDC_PAGEANT_CHECK, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_CONFIG_PAGEANT", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, IDC_PAGEANT_CHECK, uimsg);
GetDlgItemText(hWnd, BUTTON_ETC, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_CONFIG_DETAIL", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, BUTTON_ETC, uimsg);
init_password_control(hWnd, EDIT_PASSWORD);
memset(&g_JobInfo, 0, sizeof(JobInfo));
::DeleteMenu(::GetSystemMenu(hWnd, FALSE), SC_MAXIMIZE, MF_BYCOMMAND);
::DeleteMenu(::GetSystemMenu(hWnd, FALSE), SC_SIZE, MF_BYCOMMAND);
g_hIconLeft = ::LoadIcon(g_hI, (LPCSTR)ICON_LEFT);
g_hIconRight = ::LoadIcon(g_hI, (LPCSTR)ICON_RIGHT);
::SendDlgItemMessage(hWnd, BUTTON_SET, BM_SETIMAGE, (WPARAM) IMAGE_ICON, (LPARAM)(HANDLE) g_hIconLeft);
::SendDlgItemMessage(hWnd, BUTTON_DELETE, BM_SETIMAGE, (WPARAM) IMAGE_ICON, (LPARAM)(HANDLE) g_hIconRight);
::CheckRadioButton(hWnd, RADIO_LOGIN, RADIO_MACRO, RADIO_LOGIN);
EnableItem(hWnd, EDIT_MACRO, FALSE);
EnableItem(hWnd, BUTTON_MACRO, FALSE);
::CheckDlgButton(hWnd, CHECK_USER, 1);
::CheckDlgButton(hWnd, CHECK_PASSWORD, 1);
::CheckDlgButton(hWnd, CHECK_INI_FILE, 1);
InitListBox(hWnd);
return TRUE;
}
/* ==========================================================================
Function Name : (BOOL) InitEtcDlg()
Outline : 詳細設定ダイアログを初期化する。
Arguments : HWND hWnd (In) ダイアログのハンドル
Return Value : 成功 TRUE
Reference :
Renewal :
Notes :
Attention :
Up Date :
======1=========2=========3=========4=========5=========6=========7======= */
BOOL InitEtcDlg(HWND hWnd)
{
char szDefault[MAX_PATH] = DEFAULT_PATH;
char szTTermPath[MAX_PATH];
LOGFONT logfont;
HFONT font;
char uimsg[MAX_UIMSG], uitmp[MAX_UIMSG];
font = (HFONT)SendMessage(hWnd, WM_GETFONT, 0, 0);
GetObject(font, sizeof(LOGFONT), &logfont);
if (get_lang_font("DLG_TAHOMA_FONT", hWnd, &logfont, &g_DetailFont, UILanguageFile)) {
SendDlgItemMessage(hWnd, LBL_TTMPATH, WM_SETFONT, (WPARAM)g_DetailFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, EDIT_TTMPATH, WM_SETFONT, (WPARAM)g_DetailFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, BUTTON_TTMPATH, WM_SETFONT, (WPARAM)g_DetailFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, LBL_OPTION, WM_SETFONT, (WPARAM)g_DetailFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, EDIT_OPTION, WM_SETFONT, (WPARAM)g_DetailFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, GRP_INITFILE, WM_SETFONT, (WPARAM)g_DetailFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, EDIT_INITFILE, WM_SETFONT, (WPARAM)g_DetailFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, BUTTON_INITFILE, WM_SETFONT, (WPARAM)g_DetailFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, GRP_AUTOLOGIN, WM_SETFONT, (WPARAM)g_DetailFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, LBL_LOG, WM_SETFONT, (WPARAM)g_DetailFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, EDIT_LOG, WM_SETFONT, (WPARAM)g_DetailFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, BUTTON_LOG, WM_SETFONT, (WPARAM)g_DetailFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, GRP_PROMPT, WM_SETFONT, (WPARAM)g_DetailFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, LBL_PROMPT_USER, WM_SETFONT, (WPARAM)g_DetailFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, EDIT_PROMPT_USER, WM_SETFONT, (WPARAM)g_DetailFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, LBL_PROMPT_PASS, WM_SETFONT, (WPARAM)g_DetailFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, EDIT_PROMPT_PASS, WM_SETFONT, (WPARAM)g_DetailFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, IDOK, WM_SETFONT, (WPARAM)g_DetailFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, BUTTON_DEFAULT, WM_SETFONT, (WPARAM)g_DetailFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, IDCANCEL, WM_SETFONT, (WPARAM)g_DetailFont, MAKELPARAM(TRUE,0)); }
else {
g_DetailFont = NULL;
}
GetWindowText(hWnd, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_ETC_TITLE", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetWindowText(hWnd, uimsg);
GetDlgItemText(hWnd, LBL_TTMPATH, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_ETC_APP", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, LBL_TTMPATH, uimsg);
GetDlgItemText(hWnd, LBL_OPTION, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_ETC_OPTION", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, LBL_OPTION, uimsg);
GetDlgItemText(hWnd, GRP_INITFILE, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_ETC_CONFIG", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, GRP_INITFILE, uimsg);
GetDlgItemText(hWnd, GRP_AUTOLOGIN, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_ETC_AUTO", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, GRP_AUTOLOGIN, uimsg);
GetDlgItemText(hWnd, LBL_LOG, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_ETC_LOGFILE", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, LBL_LOG, uimsg);
GetDlgItemText(hWnd, GRP_PROMPT, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_ETC_PROMPT", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, GRP_PROMPT, uimsg);
GetDlgItemText(hWnd, LBL_PROMPT_USER, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_ETC_USER", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, LBL_PROMPT_USER, uimsg);
GetDlgItemText(hWnd, LBL_PROMPT_PASS, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_ETC_PASS", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, LBL_PROMPT_PASS, uimsg);
GetDlgItemText(hWnd, BUTTON_DEFAULT, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("BTN_DEFAULT", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, BUTTON_DEFAULT, uimsg);
GetDlgItemText(hWnd, IDOK, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("BTN_OK", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, IDOK, uimsg);
GetDlgItemText(hWnd, IDCANCEL, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("BTN_CANCEL", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, IDCANCEL, uimsg);
if (::lstrlen(g_JobInfo.szTeraTerm) == 0) {
::GetProfileString("Tera Term Pro", "Path", szDefault, szTTermPath, MAX_PATH);
::wsprintf(g_JobInfo.szTeraTerm, "%s\\%s", szTTermPath, g_JobInfo.bTtssh ? TTSSH : TERATERM);
}
if (g_JobInfo.bTtssh == TRUE && lstrstri(g_JobInfo.szTeraTerm, TTSSH) == NULL)
::wsprintf(g_JobInfo.szTeraTerm, "%s\\%s", szTTermPath, TTSSH);
if (::lstrlen(g_JobInfo.szLoginPrompt) == 0) {
::lstrcpy(g_JobInfo.szLoginPrompt, LOGIN_PROMPT);
}
if (::lstrlen(g_JobInfo.szPasswdPrompt) == 0) {
::lstrcpy(g_JobInfo.szPasswdPrompt, PASSWORD_PROMPT);
}
::SetDlgItemText(hWnd, EDIT_TTMPATH, g_JobInfo.szTeraTerm);
::SetDlgItemText(hWnd, EDIT_INITFILE, g_JobInfo.szInitFile);
::SetDlgItemText(hWnd, EDIT_OPTION, g_JobInfo.szOption);
::SetDlgItemText(hWnd, EDIT_PROMPT_USER, g_JobInfo.szLoginPrompt);
::SetDlgItemText(hWnd, EDIT_PROMPT_PASS, g_JobInfo.szPasswdPrompt);
::SetDlgItemText(hWnd, EDIT_LOG, g_JobInfo.szLog);
return TRUE;
}
/* ==========================================================================
Function Name : (BOOL) InitVersionDlg()
Outline : 「バージョン情報」ダイアログを初期化する。
Arguments : HWND hWnd (In) ダイアログのハンドル
Return Value : 成功 TRUE
Reference :
Renewal :
Notes :
Attention :
Up Date :
======1=========2=========3=========4=========5=========6=========7======= */
BOOL InitVersionDlg(HWND hWnd)
{
int a, b, c, d;
char app[_MAX_PATH], buf[1024], buf2[1024];
LOGFONT logfont;
HFONT font;
char uimsg[MAX_UIMSG], uitmp[MAX_UIMSG];
font = (HFONT)SendMessage(hWnd, WM_GETFONT, 0, 0);
GetObject(font, sizeof(LOGFONT), &logfont);
if (get_lang_font("DLG_TAHOMA_FONT", hWnd, &logfont, &g_AboutFont, UILanguageFile)) {
SendDlgItemMessage(hWnd, IDC_VERSION, WM_SETFONT, (WPARAM)g_AboutFont, MAKELPARAM(TRUE,0));
SendDlgItemMessage(hWnd, IDC_INCLUDE, WM_SETFONT, (WPARAM)g_AboutFont, MAKELPARAM(TRUE,0));
}
else {
g_AboutFont = NULL;
}
GetWindowText(hWnd, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("DLG_ABOUT_TITLE", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetWindowText(hWnd, uimsg);
GetDlgItemText(hWnd, IDOK, uitmp, sizeof(uitmp));
UTIL_get_lang_msg("BTN_OK", uimsg, sizeof(uimsg), uitmp, UILanguageFile);
SetDlgItemText(hWnd, IDOK, uimsg);
::DeleteMenu(::GetSystemMenu(hWnd, FALSE), SC_MAXIMIZE, MF_BYCOMMAND);
::DeleteMenu(::GetSystemMenu(hWnd, FALSE), SC_SIZE, MF_BYCOMMAND);
::DeleteMenu(::GetSystemMenu(hWnd, FALSE), SC_MINIMIZE, MF_BYCOMMAND);
::DeleteMenu(::GetSystemMenu(hWnd, FALSE), SC_RESTORE, MF_BYCOMMAND);
GetModuleFileName(NULL, app, sizeof(app));
get_file_version(app, &a, &b, &c, &d);
UTIL_get_lang_msg("DLG_ABOUT_APPNAME", uimsg, sizeof(uimsg), "launch tool", UILanguageFile);
GetDlgItemText(hWnd, IDC_VERSION, buf, sizeof(buf));
_snprintf(buf2, sizeof(buf2), buf, uimsg, a, b);
SetDlgItemText(hWnd, IDC_VERSION, buf2);
return TRUE;
}
/* ==========================================================================
Function Name : (BOOL) SetDefaultEtcDlg()
Outline : 詳細設定ダイアログの各項目にデフォルト値を設定する。
Arguments : HWND hWnd (In) ダイアログのハンドル
Return Value : 成功 TRUE
Reference :
Renewal :
Notes :
Attention :
Up Date :
======1=========2=========3=========4=========5=========6=========7======= */
BOOL SetDefaultEtcDlg(HWND hWnd)
{
char szDefault[MAX_PATH] = DEFAULT_PATH;
char szTTermPath[MAX_PATH];
::GetProfileString("Tera Term Pro", "Path", szDefault, szTTermPath, MAX_PATH);
::wsprintf(szTTermPath, "%s\\%s", szTTermPath, g_JobInfo.bTtssh ? TTSSH : TERATERM);
::SetDlgItemText(hWnd, EDIT_TTMPATH, szTTermPath);
::SetDlgItemText(hWnd, EDIT_INITFILE, "");
// デフォルトオプションに /KT , /KR を追加 (2005.1.25 yutaka)
::SetDlgItemText(hWnd, EDIT_OPTION, "/KT=UTF8 /KR=UTF8");
// ::SetDlgItemText(hWnd, EDIT_OPTION, "");
::SetDlgItemText(hWnd, EDIT_PROMPT_USER, LOGIN_PROMPT);
::SetDlgItemText(hWnd, EDIT_PROMPT_PASS, PASSWORD_PROMPT);
return TRUE;
}
/* ==========================================================================
Function Name : (BOOL) SetTaskTray()
Outline : タスクトレイにアイコンを登録/削除する。
Arguments : HWND hWnd (In) ウインドウのハンドル
: DWORD dwMessage (In) Shell_NotifyIconの第一引数
Return Value : 成功 TRUE
Reference :
Renewal :
Notes :
Attention :
Up Date :
======1=========2=========3=========4=========5=========6=========7======= */
BOOL SetTaskTray(HWND hWnd, DWORD dwMessage)
{
NOTIFYICONDATA nid;
int i;
BOOL ret;
DWORD ecode;
memset(&nid, 0, sizeof(nid));
nid.cbSize = sizeof(nid);
nid.hWnd = hWnd;
nid.uID = TTERM_ICON;