Open-Source-Software-Entwicklung und Downloads

Browse Subversion Repository

Diff of /trunk/teraterm/teraterm/ttdialog.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3226 by maya, Tue Mar 24 09:37:20 2009 UTC revision 3227 by maya, Tue Mar 24 15:10:33 2009 UTC
# Line 1  Line 1 
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  /* TERATERM.EXE, TTDLG interface */  /* TERATERM.EXE, TTDLG interface */
6  #include "teraterm.h"  #include "teraterm.h"
7  #include "tttypes.h"  #include "tttypes.h"
8  #include "ttplug.h" /* TTPLUG */  #include "ttplug.h" /* TTPLUG */
9    
10  #include "ttdialog.h"  #include "ttdialog.h"
11  #include "ttwinman.h"  #include "ttwinman.h"
12    
13  static HMODULE HTTDLG = NULL;  static HMODULE HTTDLG = NULL;
14  static TTDLGUseCount = 0;  static TTDLGUseCount = 0;
15    
16  PSetupTerminal SetupTerminal;  PSetupTerminal SetupTerminal;
17  PSetupWin SetupWin;  PSetupWin SetupWin;
18  PSetupKeyboard SetupKeyboard;  PSetupKeyboard SetupKeyboard;
19  PSetupSerialPort SetupSerialPort;  PSetupSerialPort SetupSerialPort;
20  PSetupTCPIP SetupTCPIP;  PSetupTCPIP SetupTCPIP;
21  PGetHostName GetHostName;  PGetHostName GetHostName;
22  PChangeDirectory ChangeDirectory;  PChangeDirectory ChangeDirectory;
23  PAboutDialog AboutDialog;  PAboutDialog AboutDialog;
24  PChooseFontDlg ChooseFontDlg;  PChooseFontDlg ChooseFontDlg;
25  PSetupGeneral SetupGeneral;  PSetupGeneral SetupGeneral;
26  PWindowWindow WindowWindow;  PWindowWindow WindowWindow;
27    
28  #define IdSetupTerminal   1  #define IdSetupTerminal   1
29  #define IdSetupWin        2  #define IdSetupWin        2
30  #define IdSetupKeyboard   3  #define IdSetupKeyboard   3
31  #define IdSetupSerialPort 4  #define IdSetupSerialPort 4
32  #define IdSetupTCPIP      5  #define IdSetupTCPIP      5
33  #define IdGetHostName     6  #define IdGetHostName     6
34  #define IdChangeDirectory 7  #define IdChangeDirectory 7
35  #define IdAboutDialog     8  #define IdAboutDialog     8
36  #define IdChooseFontDlg   9  #define IdChooseFontDlg   9
37  #define IdSetupGeneral    10  #define IdSetupGeneral    10
38  #define IdWindowWindow    11  #define IdWindowWindow    11
39    
40  BOOL LoadTTDLG()  BOOL LoadTTDLG()
41  {  {
42    BOOL Err;    BOOL Err;
43    
44    if (HTTDLG == NULL)    if (HTTDLG == NULL)
45    {    {
46      TTDLGUseCount = 0;      TTDLGUseCount = 0;
47    
48      HTTDLG = LoadLibrary("TTPDLG.DLL");      HTTDLG = LoadLibrary("TTPDLG.DLL");
49      if (HTTDLG==NULL) return FALSE;      if (HTTDLG==NULL) return FALSE;
50    
51      TTDLGSetUILanguageFile(ts.UILanguageFile);      TTDLGSetUILanguageFile(ts.UILanguageFile);
52    
53      Err = FALSE;      Err = FALSE;
54      SetupTerminal = (PSetupTerminal)GetProcAddress(HTTDLG,      SetupTerminal = (PSetupTerminal)GetProcAddress(HTTDLG,
55        MAKEINTRESOURCE(IdSetupTerminal));        MAKEINTRESOURCE(IdSetupTerminal));
56      if (SetupTerminal==NULL) Err = TRUE;      if (SetupTerminal==NULL) Err = TRUE;
57    
58      SetupWin = (PSetupWin)GetProcAddress(HTTDLG,      SetupWin = (PSetupWin)GetProcAddress(HTTDLG,
59        MAKEINTRESOURCE(IdSetupWin));        MAKEINTRESOURCE(IdSetupWin));
60      if (SetupWin==NULL) Err = TRUE;      if (SetupWin==NULL) Err = TRUE;
61    
62      SetupKeyboard = (PSetupKeyboard)GetProcAddress(HTTDLG,      SetupKeyboard = (PSetupKeyboard)GetProcAddress(HTTDLG,
63        MAKEINTRESOURCE(IdSetupKeyboard));        MAKEINTRESOURCE(IdSetupKeyboard));
64      if (SetupKeyboard==NULL) Err = TRUE;      if (SetupKeyboard==NULL) Err = TRUE;
65    
66      SetupSerialPort = (PSetupSerialPort)GetProcAddress(HTTDLG,      SetupSerialPort = (PSetupSerialPort)GetProcAddress(HTTDLG,
67        MAKEINTRESOURCE(IdSetupSerialPort));        MAKEINTRESOURCE(IdSetupSerialPort));
68      if (SetupSerialPort==NULL) Err = TRUE;      if (SetupSerialPort==NULL) Err = TRUE;
69    
70      SetupTCPIP = (PSetupTCPIP)GetProcAddress(HTTDLG,      SetupTCPIP = (PSetupTCPIP)GetProcAddress(HTTDLG,
71        MAKEINTRESOURCE(IdSetupTCPIP));        MAKEINTRESOURCE(IdSetupTCPIP));
72      if (SetupTCPIP==NULL) Err = TRUE;      if (SetupTCPIP==NULL) Err = TRUE;
73    
74      GetHostName = (PGetHostName)GetProcAddress(HTTDLG,      GetHostName = (PGetHostName)GetProcAddress(HTTDLG,
75        MAKEINTRESOURCE(IdGetHostName));        MAKEINTRESOURCE(IdGetHostName));
76      if (GetHostName==NULL) Err = TRUE;      if (GetHostName==NULL) Err = TRUE;
77    
78      ChangeDirectory = (PChangeDirectory)GetProcAddress(HTTDLG,      ChangeDirectory = (PChangeDirectory)GetProcAddress(HTTDLG,
79        MAKEINTRESOURCE(IdChangeDirectory));        MAKEINTRESOURCE(IdChangeDirectory));
80      if (ChangeDirectory==NULL) Err = TRUE;      if (ChangeDirectory==NULL) Err = TRUE;
81    
82      AboutDialog = (PAboutDialog)GetProcAddress(HTTDLG,      AboutDialog = (PAboutDialog)GetProcAddress(HTTDLG,
83        MAKEINTRESOURCE(IdAboutDialog));        MAKEINTRESOURCE(IdAboutDialog));
84      if (AboutDialog==NULL) Err = TRUE;      if (AboutDialog==NULL) Err = TRUE;
85    
86      ChooseFontDlg = (PChooseFontDlg)GetProcAddress(HTTDLG,      ChooseFontDlg = (PChooseFontDlg)GetProcAddress(HTTDLG,
87        MAKEINTRESOURCE(IdChooseFontDlg));        MAKEINTRESOURCE(IdChooseFontDlg));
88      if (ChooseFontDlg==NULL) Err = TRUE;      if (ChooseFontDlg==NULL) Err = TRUE;
89    
90      SetupGeneral = (PSetupGeneral)GetProcAddress(HTTDLG,      SetupGeneral = (PSetupGeneral)GetProcAddress(HTTDLG,
91        MAKEINTRESOURCE(IdSetupGeneral));        MAKEINTRESOURCE(IdSetupGeneral));
92      if (SetupGeneral==NULL) Err = TRUE;      if (SetupGeneral==NULL) Err = TRUE;
93    
94      WindowWindow = (PWindowWindow)GetProcAddress(HTTDLG,      WindowWindow = (PWindowWindow)GetProcAddress(HTTDLG,
95        MAKEINTRESOURCE(IdWindowWindow));        MAKEINTRESOURCE(IdWindowWindow));
96      if (WindowWindow==NULL) Err = TRUE;      if (WindowWindow==NULL) Err = TRUE;
97    
98      if (Err)      if (Err)
99      {      {
100        FreeLibrary(HTTDLG);        FreeLibrary(HTTDLG);
101        HTTDLG = NULL;        HTTDLG = NULL;
102        return FALSE;        return FALSE;
103      }      }
104    
105      TTXGetUIHooks(); /* TTPLUG */      TTXGetUIHooks(); /* TTPLUG */
106    }    }
107    TTDLGUseCount++;    TTDLGUseCount++;
108    return TRUE;    return TRUE;
109  }  }
110    
111  BOOL FreeTTDLG()  BOOL FreeTTDLG()
112  {  {
113    if (TTDLGUseCount==0) return FALSE;    if (TTDLGUseCount==0) return FALSE;
114   TTDLGUseCount--;   TTDLGUseCount--;
115    if (TTDLGUseCount>0) return TRUE;    if (TTDLGUseCount>0) return TRUE;
116    if (HTTDLG!=NULL)    if (HTTDLG!=NULL)
117    {    {
118      FreeLibrary(HTTDLG);      FreeLibrary(HTTDLG);
119      HTTDLG = NULL;      HTTDLG = NULL;
120    }    }
121    return FALSE;    return FALSE;
122  }  }
123    

Legend:
Removed from v.3226  
changed lines
  Added in v.3227

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26