2 ==============================================================================
4 This file is part of the mini timer
5 Copyright 2005-10 by Satoshi Fujiwara.
7 mini timer can be redistributed and/or modified under the terms of the
8 GNU General Public License, as published by the Free Software Foundation;
9 either version 2 of the License, or (at your option) any later version.
11 mini timer is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with mini timer; if not, visit www.gnu.org/licenses or write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330,
19 Boston, MA 02111-1307 USA
21 ==============================================================================
24 #include "toplevel_window.h"
25 #include "sf_windows.h"
26 #include "message_loop.h"
28 #include "application.h"
32 std::wstring application::app_id_(L"SF.MiniTimerDebug");
34 std::wstring application::app_id_(L"SF.MiniTimer");
37 int application::execute(HINSTANCE hInstance,
38 HINSTANCE hPrevInstance,
42 UNREFERENCED_PARAMETER(hPrevInstance);
43 UNREFERENCED_PARAMETER(lpCmdLine);
45 std::wcout.imbue(std::locale(""));
47 // 2
\8fd
\8bN
\93®
\82Ì
\96h
\8e~
48 SECURITY_DESCRIPTOR sd;
49 InitializeSecurityDescriptor(&sd,SECURITY_DESCRIPTOR_REVISION);
50 SetSecurityDescriptorDacl(&sd, TRUE, 0, FALSE);
51 SECURITY_ATTRIBUTES sec_attr;
52 sec_attr.nLength = sizeof (sec_attr);
53 sec_attr.lpSecurityDescriptor = &sd;
54 sec_attr.bInheritHandle = TRUE;
56 sf::handle_holder handle(::CreateMutex(&sec_attr, FALSE, _T("wintimer_mutex_debug")));
58 sf::handle_holder handle(::CreateMutex(&sec_attr, FALSE, _T("wintimer_mutex")));
61 if(NULL == handle.get() || ::GetLastError() == ERROR_ALREADY_EXISTS)
66 // COM
\82Ì
\8f\89\8aú
\89»
67 sf::com_initialize init();
69 //
\83A
\83v
\83\8a\83P
\81[
\83V
\83\87\83\93ID
\82Ì
\93o
\98^
70 sf::throw_if_err<application::exception>()(SetCurrentProcessExplicitAppUserModelID(app_id_.c_str()));
73 //
\83E
\83B
\83\93\83h
\83E
\82Ì
\8dì
\90¬
74 sf::toplevel_window_ptr
76 sf::create_toplevel_window(
77 std::wstring(L"
\83~
\83j
\83^
\83C
\83}
\81["),std::wstring(L"
\83~
\83j
\83^
\83C
\83}
\81[")));
79 //
\83\81\83b
\83Z
\81[
\83W
\83\8b\81[
\83v
\82Ì
\8eÀ
\8ds
80 WPARAM ret = sf::run_message_loop()();