OSDN Git Service

first commit
[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 //---------------------------------------------------------------------------
21 #include "prgconfig.h"
22 #include "DCHookMain.h"
23 //---------------------------------------------------------------------------
24
25 WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
26 {
27 #if __PROTO
28         SYSTEMTIME st;
29         GetSystemTime(&st);
30         if ( (st.wYear>=2016 && st.wMonth>=12) || st.wYear>=2017){
31                 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);
32                 if (ret != IDNO){
33                         ShowLatestVersion();
34                         return 0;
35                 }
36         }
37 #endif
38
39         HWND hwnd = FindPrev();
40         if ( hwnd ){
41                 if (CheckVersion(hwnd)<0){
42                         // The older version already lauched.
43                         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);
44                         return 0;
45                 }
46                 MoveToTop( hwnd );
47                 return 0;
48         }
49         try
50         {
51                 Application->Initialize();
52                 Application->Title = "DokoPop";
53                 Application->CreateForm(__classid(TDCHookMainForm), &DCHookMainForm);
54                 Application->Run();
55         }
56         catch (Exception &exception)
57         {
58                 Application->ShowException(&exception);
59         }
60         if (Reboot){
61                 _WinExec(Application->ExeName.c_str(), SW_SHOW, 0);
62         }
63         return 0;
64 }
65 //---------------------------------------------------------------------------
66
67