source: win32/admin/PropMain.cpp @ abe53d3

Last change on this file since abe53d3 was abe53d3, checked in by Jelmer Vernooij <jelmer@…>, at 2005-11-07T16:42:49Z

More work on config manager

  • Property mode set to 100644
File size: 2.5 KB
Line 
1// PropMain.cpp : implementation file
2//
3
4#include <afxdlgs.h>
5#include "PropMain.h"
6
7#ifdef _DEBUG
8#define new DEBUG_NEW
9#undef THIS_FILE
10static char THIS_FILE[] = __FILE__;
11#endif
12
13/////////////////////////////////////////////////////////////////////////////
14// CPropMain property page
15
16IMPLEMENT_DYNCREATE(CPropMain, CPropertyPage)
17
18CPropMain::CPropMain() : CPropertyPage(CPropMain::IDD)
19{
20        //{{AFX_DATA_INIT(CPropMain)
21                // NOTE: the ClassWizard will add member initialization here
22        //}}AFX_DATA_INIT
23}
24
25CPropMain::~CPropMain()
26{
27}
28
29void CPropMain::DoDataExchange(CDataExchange* pDX)
30{
31        CPropertyPage::DoDataExchange(pDX);
32        //{{AFX_DATA_MAP(CPropMain)
33        DDX_Control(pDX, IDC_STOPSERVICE, m_stopservice);
34        DDX_Control(pDX, IDC_STARTSERVICE, m_startservice);
35        DDX_Control(pDX, IDC_PING_INTERVAL, m_ping_interval);
36        DDX_Control(pDX, IDC_VERBOSE, m_Verbose);
37        //}}AFX_DATA_MAP
38}
39
40
41BEGIN_MESSAGE_MAP(CPropMain, CPropertyPage)
42        //{{AFX_MSG_MAP(CPropMain)
43        ON_BN_CLICKED(IDC_STARTSERVICE, OnStartService)
44        ON_BN_CLICKED(IDC_STOPSERVICE, OnStopService)
45        //}}AFX_MSG_MAP
46END_MESSAGE_MAP()
47
48/////////////////////////////////////////////////////////////////////////////
49// CPropMain message handlers
50
51BOOL CPropMain::OnInitDialog() 
52{
53        CPropertyPage::OnInitDialog();
54       
55        global.conf->verbose = GetProfileInt("verbose", 0);
56        global.conf->ping_interval = GetProfileInt("ping_interval_timeout", 0);
57       
58        return TRUE;  // return TRUE unless you set the focus to a control
59                      // EXCEPTION: OCX Property Pages should return FALSE
60}
61
62void CPropMain::OnOK() 
63{       
64        CPropertyPage::OnOK();
65
66        WriteProfileInt("verbose", global.conf->verbose);
67       
68        WriteProfileInt("ping_interval_timeout", global.conf->ping_interval);
69}
70
71void CPropMain::OnStartService() 
72{
73        SC_HANDLE   schService;
74        SC_HANDLE   schSCManager;
75        SERVICE_STATUS status;
76
77    schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS );
78        schService = OpenService(schSCManager, "bitlbee", SERVICE_ALL_ACCESS);
79       
80        ControlService( schService, SERVICE_CONTROL_CONTINUE, &status );
81
82    CloseServiceHandle(schService);
83    CloseServiceHandle(schSCManager);
84}
85
86void CPropMain::OnStopService() 
87{
88                SC_HANDLE   schService;
89        SC_HANDLE   schSCManager;
90        SERVICE_STATUS status;
91
92    schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS );
93        schService = OpenService(schSCManager, "bitlbee", SERVICE_ALL_ACCESS);
94       
95        ControlService( schService, SERVICE_CONTROL_PAUSE, &status );
96
97    CloseServiceHandle(schService);
98    CloseServiceHandle(schSCManager);
99}
Note: See TracBrowser for help on using the repository browser.