OSDN Git Service

[Release] Ver.2.1.2
[dokopop/dokopop.git] / DCHookTest / DCHookTest.cpp
1 //---------------------------------------------------------------------------
2 #include <vcl.h>
3 #pragma hdrstop
4 USERES("DCHookTest.res");
5 USEFORM("DCHookMain.cpp", DCHookMainForm);
6 USEUNIT("StringLib.cpp");
7 USEFORM("PopupConfig.cpp", PopupConfigDlg);
8 USEUNIT("Util.cpp");
9 USEFORM("Notify.cpp", NotifyForm);
10 USERC("icon.rc");
11 USEUNIT("mustr.cpp");
12 USEUNIT("HookDLl.cpp");
13 USEUNIT("HookLoader.cpp");
14 USEUNIT("DCHookLoader.cpp");
15 USE("..\Diary.txt", File);
16 USEUNIT("prgprof.cpp");
17 USEFORM("MODINotifyDlg.cpp", MODINotifyDialog);
18 USEUNIT("prgconfig.cpp");
19 USEFORM("OCRTextFrm.cpp", OCRTextForm);
20 USEUNIT("MonitorScale.cpp");
21 //---------------------------------------------------------------------------
22 #include "prgconfig.h"
23 #include "DCHookMain.h"
24 //---------------------------------------------------------------------------
25
26 WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
27 {
28 #if __PROTO
29         SYSTEMTIME st;
30         GetSystemTime(&st);
31         if ( (st.wYear>=2017 && st.wMonth>=2) || st.wYear>=2018){
32                 int ret = MessageBox(NULL, "\8e\8e\8dì\94Å\82Ì\8eg\97p\8aú\8cÀ\82ª\90Ø\82ê\82Ü\82µ\82½\81B\90V\82µ\82¢DokoPop!\82ð\93ü\8eè\82µ\82Ä\82­\82¾\82³\82¢", APPNAME, MB_YESNO);
33                 if (ret != IDNO){
34                         ShowLatestVersion();
35                         return 0;
36                 }
37         }
38 #endif
39
40         HWND hwnd = FindPrev();
41         if ( hwnd ){
42                 if (CheckVersion(hwnd)<0){
43                         // The older version already lauched.
44                         MessageBox(NULL, "DokoPop!\82ª\82·\82Å\82É\8bN\93®\82µ\82Ä\82¢\82Ü\82·\81B\r\8cÃ\82¢\83o\81[\83W\83\87\83\93\82ÌDokoPop!\82ð\83A\83\93\83C\83\93\83X\83g\81[\83\8b\82µ\82Ä\82­\82¾\82³\82¢", APPNAME, MB_OK);
45                         return 0;
46                 }
47                 MoveToTop( hwnd );
48                 return 0;
49         }
50         try
51         {
52                 Application->Initialize();
53                 Application->Title = "DokoPop";
54                 Application->CreateForm(__classid(TDCHookMainForm), &DCHookMainForm);
55                 Application->Run();
56         }
57         catch (Exception &exception)
58         {
59                 Application->ShowException(&exception);
60         }
61         if (Reboot){
62                 _WinExec(Application->ExeName.c_str(), SW_SHOW, 0);
63         }
64         return 0;
65 }
66 //---------------------------------------------------------------------------
67
68