OSDN Git Service

first commit
[dokopop/dokopop.git] / DCHookTest / Util.h
1 //---------------------------------------------------------------------------
2 #ifndef UtilH
3 #define UtilH
4 //---------------------------------------------------------------------------
5
6 /*------------------------------------------*/
7 /*              Configuration                                           */
8 /*------------------------------------------*/
9 #define USE_DDE         1       // Popup Search\82Í\81ADDE\82Å\8ds\82¤,
10                                                 // otherwise uses WM_COPYDATA message. 
11
12 #ifdef USE_UNICODE
13 #define DDE_SERVICE_NAME        "PDICU"
14 //#define       REG_PDICEXE_OLD         "Software\\ReliefOffice\\PDICU"
15 #define REG_PDICEXE                     "Software\\ReliefOffice\\PDIC2"
16 #define APPREGNAME                      "DokoPopU"
17 #define NAME_PDICEXE            "PDICU.EXE"
18 #define NAME_DKPPTXT            "DKPU.TXT"
19 #define NAME_DKPPHKDLL          "DKPUHK.DLL"
20 #define NAME_BMPFILE            "DKPU.BMP"
21 #define FMTS                            "%ws"
22 #else
23 #define DDE_SERVICE_NAME        "PDICW"
24 #define REG_PDICEXE                     "Software\\ReliefOffice\\PDICW32"
25 #define APPREGNAME                      "DokoPop"
26 #define NAME_PDICEXE            "PDICW32.EXE"
27 #define NAME_DKPPTXT            "DKPP.TXT"
28 #define NAME_DKPPHKDLL          "DKPPHK.DLL"
29 #define NAME_BMPFILE            "DKPP.BMP"
30 #define FMTS                            "%s"
31 #endif
32 extern const char APPNAME[];
33
34 /*------------------------------------------*/
35 /*              Type Definitions                                        */
36 /*------------------------------------------*/
37
38 #define WMCD_EXISTCHECK         0x4000
39
40 #define WM_GET_VERSION          (WM_APP+0x300)
41
42 #define foreach(obj, it, type) \
43         for (type::iterator it=(obj).begin();it!=(obj).end();it++)
44
45 #ifdef __VCL0_H__
46
47 #define VCL_SIZEABLE()  do {BorderStyle = bsSizeable;} while(0) //TODO: VCL Bug
48
49 class TMyIni {
50 public:
51         HKEY hroot;
52 public:
53         TMyIni( HKEY root, const char *soft, bool can_create );
54         ~TMyIni();
55         void WriteInteger( const char *section, const char *key, int val );
56         int ReadInteger( const char *section, const char *key, int val );
57         void WriteString( const char *section, const char *key, const char *str );
58         AnsiString ReadString( const char *section, const char *key, const char *str );
59         void ReadValues( const char *section, TStrings *strs );
60 };
61
62 class TAppIni : public TMyIni {
63 typedef TMyIni super;
64 public:
65         TAppIni();
66 };
67
68 void LoadForm( const char *section, TForm *form, HWND hwnd );
69 void SaveForm( const char *section, TForm *form, HWND hwnd );
70 #endif
71
72 /*------------------------------------------*/
73 /*              Prototypes                                                      */
74 /*------------------------------------------*/
75 bool LaunchPdic();
76 bool MODIInstalled();
77 bool AMODIRunable();
78 bool LaunchAMODI();
79 void TerminateAMODI();
80 void ShowAMODI();
81
82 bool CheckPassword( const char *str );
83 void CheckWOW64();
84 void MoveToTop( HWND hwnd );
85 void MoveCenter( HWND hwnd, HWND hwndParent );
86 void GetScreenSize(HWND hwndBase, RECT *rcWork, RECT *rcScreen=NULL);
87 bool _WinExec( const char *cmd, int show, int waittime, const char *dir=NULL);
88 HANDLE WinExecEx( const char *cmd, int show, const char *dir=NULL, const char *title=NULL );
89 HWND FindApp(const char *clsname, const char *wndname, const char *appname);
90 HWND FindPrev();
91 int CheckVersion(HWND hwnd);
92 HWND FindAMODI();
93 HWND FindPopupWindow( );
94
95 void ShowManual( HWND hwnd );
96 void ShowLatestVersion();
97
98 unsigned GetDNFVersion();       // get .NET Framework version
99
100 void dbw( const char *format, ... );
101
102 #ifdef _DEBUG
103 #define DBW     dbw
104 #else
105 #define DBW     (void)
106 #endif
107
108 /*------------------------------------------*/
109 /*              Global Variables                                        */
110 /*------------------------------------------*/
111 extern const char *AppName;
112 extern const char *StrVersion;
113 extern int VersionValue;
114 extern bool WindowsNT;
115 extern bool fWow64;
116
117 #endif
118