Using C + + Windows services for the preparation of the general framework
Below are the Service, I wrote a procedural framework to achieve the following functions:
1. Service surveillance window created.
2. Message Handling Service in the realization of
3. C + + class use.
4. Work function of the use of threads.
**** If you need to complete specific tasks, simply threading function and specific examples of ***.
(Note that the procedures used in Japanese writing, because I machinery OS is a Japanese WIN 2000, VC is also Japanese VC6.0 can not support Chinese, sorry)
/ *
Japanese payãƒãƒ¼jinnョンformer contents
20040706 1.00 SecBug new regulations make
* /
Class MyServiceModel
(
Public:
MyServiceModel ();
Virtual ~ MyServiceModel ();
Private:
/ / Alter a few
/ / Moses Arabic nameス
LPCTSTR serviceName;
/ / Moses Arabicスwho maintain their state of things!
SERVICE_STATUS serviceStatus;
/ / Private Moses Arabicスtheir AL-HaンAd
SERVICE_STATUS_HANDLE serviceStatusHandle;
HWND hCMain_seivice_data;
//————— Private ———–
/ / Event used to hold ServiceMain from completing
HANDLE terminateEvent;
/ / Thread for the actual work
HANDLE threadHandle;
/ / Flags holding current state of service
BOOL pauseService;
BOOL runningService;
/ /メソAllah Ad
Public:
/ /メインメソAllah Ad:
Int main (int argc, TCHAR * argv []);
/ / Moses ArabicスインスLot the Criterion:
Void InstallService ();
/ / Moses Arabicス- AnインスLot the Criterion:
Void UninstallService ();
/ / Moses Arabicスメイン:
Void WINAPI ServiceMain (DWORD argc, TCHAR * argv []);
/ / Moses ArabicスperfectedンLot mouths the Criterion HaンAd Allah:
Void WINAPI ServiceControlHandler (DWORD contorlCode);
/ / Pharaoh Pharaohインtribe. However mouths treesーjinnャ:
LRESULT CALLBACK WndProc (HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
//————— Private ———–
/ / Pharaoh Pharaohインtribe. However mouths treesーjinnャ
Static LRESULT CALLBACK _WndProc (
HWND hDlg,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
/ / Moses ArabicスperfectedンLot mouths the Criterion HaンAd Allah
Static void WINAPI _ServiceControlHandler (DWORD contorlCode);
/ / Moses Arabicスメイン
Static void WINAPI _ServiceMain (DWORD argc, TCHAR * argv []);
BOOL CreateSvcWindow ();
/ / Allah deal with Israel
Void ErrorHandler (char * s, DWORD err);
/ / Moses Arabicスthings ended!
VOID terminate (DWORD error);
/ /スSeteーconcertスreport things!
BOOL SendStatusToSCM (
DWORD dwCurrentState,
DWORD dwWin32ExitCode,
DWORD dwServiceSpecificExitCode,
DWORD dwCheckPoint,
DWORD dwWaitHint
);
/ / End of Moses in Arabicス
VOID StopService ();
/ / Beginning of Moses in Arabicス
BOOL InitService ();
/ / Browser jinnメMoses Arabicス
VOID ResumeService ();
/ /ãƒãƒ¼Thul Moses Arabicス
VOID PauseService ();
/ /
BOOL RunService (char * sSvcName);
);
/ /スbroadcasts Commissioner of Allah Ad
DWORD WINAPI ServiceThread (LPDWORD param);
/ *
Japanese payãƒãƒ¼jinnョンformer contents
20040706 1.00 SecBug new regulations make
* /
/ / Declaration of a Change
Extern MyServiceModel objApp;
////////////////////////////////////////////////// ////////////////////
/ / Build / eradication
////////////////////////////////////////////////// ////////////////////
/ *
Build function
Static
Public visibility
メソAllah tribe were MyServiceModel
Reply few
Notã—
Back than you valueã—
* /
MyServiceModel:: MyServiceModel ()
(
/ / Moses Arabic nameス
ServiceName = "MyServiceName";
/ / Moses Arabicスwho maintain their state of things!
ServiceStatusHandle = NULL;
)
/ *
Function eradication
Static
Public visibility
メソAllah tribe were to MyServiceModel
Reply few
Notã—
Back than you valueã—
* /
MyServiceModel:: ~ MyServiceModel ()
(
)
/ *
FunctionメインメソAllah Ad
Static
Public visibility
メソwhom were main Ad
Reply few
Reply of their number [IN] argc int initial value notã—
Reply of the [IN] [] * argv TCHAR initial value notã—
Back than value
Int often Lo 0
Note
Notã—
* /
Int MyServiceModel:: main (int argc, TCHAR * argv [])
(
Int iRet = 0;
TCHAR TServceName [256];
Strcpy (TServceName, SVCSTARTNAME);
SERVICE_TABLE_ENTRY dispatchTable [] =
(
(TEXT (TServceName), (LPSERVICE_MAIN_FUNCTION) _ServiceMain),
(NULL, NULL)
);
/ / Reply of their defeatedã‚§Allah Talk:
If (argc <= 1)
(
/ / GrapesランTalk is their occasions, usage (use)
Cout << "usage:" <<ENDL;
/ / Cout << "zxz \" zxz "<<ENDL;
/ / "Install"
Cout << "\" install \ "";
/ / "Or"
Cout << "or";
/ / "Uninstall"
Cout << "\" uninstall \ "";
/ / The "exec"
Cout << "\" exec \ "";
Cout << "parameter required in the command line" <<ENDL;?
)
/ / Install their occasions, Moses Arabicスtheir login wrong-doers (InstallService breath)
If (argc> 1)
(
If (_stricmp ( "install", argv [1]) == 0)
(
InstallService ();
)
/ / Uninstall their occasions, Moses Arabicスtheir trimmed away wrong-doers (UninstallService breath)
Else if (_stricmp ( "uninstall", argv [1]) == 0)
(
UninstallService ();
)
/ / Exec their occasions, Moses Arabicスstarting their wrong-doers (ServiceMain breath)
Else if (_stricmp ( "exec", argv [1]) == 0)
(
RunService (SVCSTARTNAME);
)
/ / GrapesランTalk is their occasions, usage (use)
Else
(
Cout << "usage:" <<ENDL;
/ / "Install"
Cout << "\" install \ "";
/ / "Or"
Cout << "or";
/ / "Uninstall"
Cout << "\" uninstall \ "";
/ / The "exec"
Cout << "\" exec \ "";
/ / "Or"
Cout << "or";
Cout << "parameter required in the command line" <<ENDL;
)
)
/ / Lecture their grapesランoccasions, Moses Arabicスstarting their wrong-doers (RunService breath)
Else
(
/ / RunService exhaled
BOOL success;
StartServiceCtrlDispatcher success = (dispatchTable);
If (success)
(
ErrorHandler ( "In StartServiceCtrlDispatcher", GetLastError ());
)
)
/ / Value back than regular Lo 0
IRet = 0;
Return iRet;
)
/ *
Function Moses ArabicスインスLot the Criterion
Static
Public visibility
メソAllah tribe were InstallService
Reply few
Notã—
Back than value
Notã—
Note
Moses ArabicスtheirインスLot the Criterion wrong-doers
* /
Void MyServiceModel:: InstallService ()
(
SC_HANDLE schService;
SC_HANDLE schSCManager;
TCHAR szPath [512];
Cout << "Install Starting …"<< ENDL;
/ /フmaterialイAl HornースãŠthings were!
If (! GetModuleFileName (NULL, szPath, 512))
(
ErrorHandler ( "In GetModuleFileName", GetLastError ());
Return;
)
/ / Open perfectedãƒTalk treesョンto SCM
SchSCManager = OpenSCManager (
0, / / pointer to machine name string
0, / / pointer to database name string
SC_MANAGER_CREATE_SERVICE / / type of access
);
If (! SchSCManager)
(
ErrorHandler ( "In OpenScManager", GetLastError ());
Return;
)
/ / Install new Moses Arabicス
CreateService schService = (
SchSCManager, / / handle to service control manager database
SVCSTARTNAME, / / pointer to name of service to start
SVCDISPLNAME, / / pointer to display name
SERVICE_ALL_ACCESS, / / type of access to service
SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS, / / type of service
SERVICE_DEMAND_START, / / when to start service
SERVICE_ERROR_NORMAL, / / severity if service fails to start
SzPath, / / pointer to name of binary file
NULL, / / pointer to name of load ordering group
NULL, / / pointer to variable to get tag identifier
NULL, / / pointer to array of dependency names
NULL, / / pointer to account name of service
NULL / / pointer to password for service account
);
If (! SchService)
(
ErrorHandler ( "In CreateService", GetLastError ());
Return;
)
Else
(
Cout << "Service installed \ n";
)
/ / Clean up
CloseServiceHandle (schService);
CloseServiceHandle (schSCManager);
Cout << "Install Ending … \ n";
)
/ *
Function Moses - An ArabicスtheirインスLot the Criterion
Static
Public visibility
メソAllah tribe were UninstallService
Reply few
Notã—
Back than value
Notã—
Note
Moses - An ArabicスtheirインスLot the Criterion wrong-doers
* /
Void MyServiceModel:: UninstallService ()
(
SC_HANDLE schService;
SC_HANDLE schSCManager;
BOOL success;
SERVICE_STATUS svcStatus;
Cout << "Uninstall Starting …"<< ENDL;?
/ / Open perfectedãƒTalk treesョンto SCM
SchSCManager = OpenSCManager (
0, / / pointer to machine name string
0, / / pointer to database name string
SC_MANAGER_CREATE_SERVICE / / type of access
);
If (! SchSCManager)
(
ErrorHandler ( "In OpenScManager", GetLastError ());
Return;
)
/ / Moses ArabicスHa!ンSad Al-access things
SchService = OpenService (
SchSCManager, / / handle to service control manager database
SVCSTARTNAME, / / pointer to name of service to start
SERVICE_ALL_ACCESS | DELETE / / type of access to service
);
If (! SchService)
(
ErrorHandler ( "In OpenService", GetLastError ());
Return;
)
/ / Moses Arabicスend (if necessary)
QueryServiceStatus success = (schService, & svcStatus);
If (! Success)
(
ErrorHandler ( "In QueryServiceStatus", GetLastError ());
Return;
)
If (svcStatus.dwCurrentState! = SERVICE_STOPPED)
(
Cout << "Stopping service …"<< ENDL;
ControlService success = (
SchService, / / handle to service
SERVICE_CONTROL_STOP, / / control code
& SvcStatus / / pointer to service status structure
);
If (! Success)
(
ErrorHandler ( "In ControlService", GetLastError ());
Return;
)
)
/ / Moses Arabicスsign that the end of Able
Do
(
QueryServiceStatus (schService, & svcStatus);
Sleep (500);
) While (SERVICE_STOP_PENDING == svcStatus.dwCurrentState);
If (SERVICE_STOPPED! = SvcStatus.dwCurrentState)
(
ErrorHandler ( "Failed to Stop Service", GetLastError ());
Return;
)
/ / Moses Arabicスthings trimmed away!
DeleteService success = (schService);
If (success)
(
Cout << "Service removed \ n";
)
Else
(
ErrorHandler ( "In DeleteService", GetLastError ());
Return;
)
/ / Moses ArabicスClean up
CloseServiceHandle (schService);
CloseServiceHandle (schSCManager);
Cout << "Uninstal Ending …"<< ENDL;?
)
/ *
Function Moses Arabicスメイン
Static
Public visibility
メソAllah tribe were ServiceMain
Reply few
Reply of their number [IN] argc DWORD notã—
Reply of the [IN] [] * argv TCHAR notã—
Back than value
Notã—
Note
DamascoンLot mouths the Criterion Hornãƒremember Moses in Arabic. HoweverスAllah commandedケーtreesョンwho opened him, Moses Arabicスhave chosen Ze and do [start] Allah who commanded Talk Talkã—when you Lo, from SCM summon slain.
Moses Arabicスtheirメインdeal with wrong-doers:
* /
Void WINAPI MyServiceModel:: ServiceMain (DWORD argc, TCHAR * argv [])
(
BOOL success;
/ / SCM Lo HaンAdラCommissioner few who cross!
RegisterServiceCtrlHandler serviceStatusHandle = (
SVCSTARTNAME,
(LPHANDLER_FUNCTION) _ServiceControlHandler
);
If (! ServiceStatusHandle)
(
Terminate (GetLastError ());
Return;
)
/ / Moses Arabicスstate who started things Lo!
SendStatusToSCM success = (
SERVICE_START_PENDING,
NO_ERROR,
0,
1.
5000
);
If (! Success)
(
Terminate (GetLastError ());
Return;
)
/ / EndイservantsンLot create things!
CreateEvent terminateEvent = (
0,
TRUE,
FALSE,
0
);
If (! TerminateEvent)
(
Terminate (GetLastError ());
Return;
)
/ / SCM things briefing!
SendStatusToSCM success = (
SERVICE_START_PENDING,
NO_ERROR,
0,
2.
1000
);
If (! Success)
(
Terminate (GetLastError ());
Return;
)
/ / Early Arabicスof Moses,
/ /メAllah Centerーphoto ID who made deeds, and to alter the numberãŠ
/ / Ad Pharaoh Pharaohインmake their
InitService success = ();
If (! Success)
(
Terminate (GetLastError ());
Return;
)
/ / Moses Arabicスtruth trip.
/ / SCM things briefing!
SendStatusToSCM success = (
SERVICE_RUNNING,
NO_ERROR,
0,
0,
0
);
If (! Success)
(
Terminate (GetLastError ());
Return;
)
/ / Moses in Arabic to stop us theirス
WaitForSingleObject (terminateEvent, INFINITE);
/ / Moses Arabic Loスstate who stop and the earth.
Terminate (0);
)
/ *
Function Moses ArabicスperfectedンLot mouths the Criterion HaンAd Allah
Static
Public visibility
メソAllah tribe were ServiceControlHandler
Reply few
State perfected the tribe [IN] contorlCode DWORD notã—
Back than value
Notã—
Note
"SCM when Moses ArabicスtheirスSeteーwho in concertスthan you, you stop soon stop whatever 1:00 of the command who Moses ArabicスLo things not for the delivery from SCM summon slain.
SCM is Handler Lo, the truth will speak of their treatment table! Types who deal with the tribe who Damasco crossingã—me.
1. Moses Arabicスstop to notice when you occasions, Moses Arabic Loスstop a Change
2. Stop dealing with wrong-doers (ServiceMain Lo who stop notice)
3. Their occasions And he is not what Had
* /
Void WINAPI MyServiceModel:: ServiceControlHandler (DWORD contorlCode)
(
DWORD currentState = 0;
BOOL success;
Switch (contorlCode)
(
/ / There is no START option because
/ / ServiceMain gets called on a start
/ / Moses Arabicスthings ended!
Case SERVICE_CONTROL_STOP:
CurrentState = SERVICE_STOP_PENDING;
/ / Tell the SCM what's happening
SendStatusToSCM success = (
SERVICE_STOP_PENDING,
NO_ERROR,
0,
1.
5000
);
/ / Not much to do if not successful
/ / Stop the service
StopService ();
Return;
/ / Moses Arabicスãƒãƒ¼Thul
Case SERVICE_CONTROL_PAUSE:
If (runningService & &! PauseService)
(
/ / Tell the SCM what's happening
SendStatusToSCM success = (
SERVICE_PAUSE_PENDING,
NO_ERROR,
0,
1.
1000);
PauseService ();
CurrentState = SERVICE_PAUSED;
)
Break;
/ / Moses Arabicスonly for those men again
Case SERVICE_CONTROL_CONTINUE:
If (runningService & pauseService)
(
/ / Tell the SCM what's happening
SendStatusToSCM success = (
SERVICE_CONTINUE_PENDING,
NO_ERROR,
0,
1.
1000
);
ResumeService ();
CurrentState = SERVICE_RUNNING;
)
Break;
/ / Moses Arabicスtheir present theirスSeteーconcertスupdate
Case SERVICE_CONTROL_INTERROGATE:
/ / It will fall to bottom and send status
Break;
/ / Do nothing in a shutdown. Could do cleanup
/ / Here but it must be very quick.
Case SERVICE_CONTROL_SHUTDOWN:
/ / Do nothing on shutdown
Return;
Default:
Break;
)
/ / Moses Arabicスtheir present theirスSeteーconcertスupdate
SendStatusToSCM (
CurrentState,
NO_ERROR,
0,
0,
0
);
)
/ *
Adインfunction Pharaoh Pharaoh. However mouths treesーjinnャ
Static
Public visibility
メソAllah tribe of WndProc
Reply few
Pharaoh PharaohインSad Sad HaンAL-[IN] hDlg HWND notã—
メAllah Centerーjinn [IN] Msg UINT notã—
Hornラメconcert 1 [IN] wParam WPARAM notã—
Hornラメconcert 2 [IN] lParam LPARAM notã—
Back than value
LRESULT
Note
"Pharaoh PharaohインAdメAllah Centerーjinn their analytical processing wrong-doers
* /
LRESULT CALLBACK MyServiceModel:: WndProc (HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
(LRESULT lrRet;
/ *
/ / Test begin
HDC hdc;
PAINTSTRUCT ps;
Int x, y;
X = 60;
Y = 20;
Test end
* /
Switch (Msg)
(
Case WM_DESTROY:
PostQuitMessage (0);
Break;
);
/ / And heメAllah Centerーtheir photo is their occasions, DefWindowProc who exhaled "
LrRet = DefWindowProc (hDlg, Msg, wParam, lParam);
Return lrRet;
)
/ *
Israel Allah processing function
Static
Visibility private
メソAllah tribe were ErrorHandler
Reply few
Hornラメconcert 1 [IN] char * s notã—
Hornラメconcert 2 [IN] DWORD err notã—
Back than value
Notã—
Note
Notã—
* /
Void MyServiceModel:: ErrorHandler (char * s, DWORD err)
(
Cout <<S <<ENDL;
Cout << "Error number:" <<err <<endl;
Char str1 [50];
Char str2 [20];
Memset (str1, 0, sizeof (str1));
Memset (str2, 0, sizeof (str2));
Strcpy (str1, s);
Strcat (str1, "Error Code:");
Itoa (err, str2, 10);
Strcat (str1, str2);
ExitProcess (err);
)
/ *
Function Moses Arabicスthings ended!
Static
Visibility private
メソAllah who terminate Ad
Reply few
Hornラメconcert DWORD error notã—
Back than value
Notã—
Note
Moses Arabicスthings ended!
* /
VOID MyServiceModel:: terminate (DWORD error)
(
/ / If terminateEvent has been created, and close it.
If (terminateEvent)
CloseHandle (terminateEvent);
/ / Send a message to the scm to tell about
/ / Stopage
If (serviceStatusHandle)
SendStatusToSCM (SERVICE_STOPPED, error,
0, 0, 0);
/ / If the thread has started kill it off
If (threadHandle)
CloseHandle (threadHandle);
/ / Do not need to close serviceStatusHandle
)
/ *
FunctionスSeteーconcertスreport things!
Static
Visibility private
メソof Allah Ad
Reply few
Hornラメconcert a DWORD dwCurrentState,
Hornラメconcert 2 DWORD dwWin32ExitCode,
Hornラメconcert DWORD dwServiceSpecificExitCode 3,
Hornラメconcert DWORD dwCheckPoint 4,
Hornラメconcert 5 DWORD dwWaitHint
Back than value
Notã—
Note
Consolidates the activities of updating the service status with SetServiceStatus
* /
BOOL MyServiceModel:: SendStatusToSCM (DWORD dwCurrentState,
DWORD dwWin32ExitCode,
DWORD dwServiceSpecificExitCode,
DWORD dwCheckPoint,
DWORD dwWaitHint)
(
BOOL success;
SERVICE_STATUS serviceStatus;
/ / Fill in all of the SERVICE_STATUS fields
ServiceStatus.dwServiceType =
SERVICE_WIN32_OWN_PROCESS;
ServiceStatus.dwCurrentState = dwCurrentState;
/ / If in the process of something, then accept
/ / No control events, else accept anything
If (dwCurrentState == SERVICE_START_PENDING)
ServiceStatus.dwControlsAccepted = 0;
Else
ServiceStatus.dwControlsAccepted =
SERVICE_ACCEPT_STOP |
SERVICE_ACCEPT_PAUSE_CONTINUE |
SERVICE_ACCEPT_SHUTDOWN;
/ / If a specific exit code is defines, set up
/ / The win32 exit code properly
If (dwServiceSpecificExitCode == 0)
ServiceStatus.dwWin32ExitCode =
DwWin32ExitCode;
Else
ServiceStatus.dwWin32ExitCode =
ERROR_SERVICE_SPECIFIC_ERROR;
ServiceStatus.dwServiceSpecificExitCode =
DwServiceSpecificExitCode;
ServiceStatus.dwCheckPoint = dwCheckPoint;
ServiceStatus.dwWaitHint = dwWaitHint;
/ / Pass the status record to the SCM
SetServiceStatus success = (serviceStatusHandle,
& ServiceStatus);
If (! Success)
StopService ();
Return success;
)
/ *
Moses function of early Arabicス
Static
Visibility private
メソAllah tribe were InitService
Reply few
Notã—
Back than value
Notã—
Note
Initializes the service by starting its thread
* /
BOOL MyServiceModel:: InitService ()
(
DWORD id;
/ / Start the service's thread
ThreadHandle = CreateThread (0, 0,
(LPTHREAD_START_ROUTINE) ServiceThread,
0, 0, & id);
If (threadHandle == 0)
Return FALSE;
Else
(
RunningService = TRUE;
Return TRUE;
)
)
/ *
Start function Moses Arabicス
Static
Visibility private
メソAllah tribe were StartService
Reply few
SSvcName: Moses Arabic nameス
Back than value
Notã—
Note
Resumes a paused service
* /
BOOL MyServiceModel:: RunService (char * sSvcName)
(
SC_HANDLE schSCManager;
SC_HANDLE scHandle;
BOOL boolRet;
/ / Open perfectedãƒTalk treesョンto SCM
SchSCManager = OpenSCManager (
0,
0,
SC_MANAGER_ALL_ACCESS
);
/ / Open Moses Arabicス
ScHandle = OpenService (
SchSCManager,
SSvcName,
SERVICE_ALL_ACCESS
);
/ / Start Moses Arabicス
StartService boolRet = (
ScHandle,
0,
NULL);
Return boolRet;
)
/ *
Function broadcasts jinnメMoses Arabicス
Static
Visibility private
メソAllah tribe were ResumeService
Reply few
Notã—
Back than value
Notã—
Note
Resumes a paused service
* /
VOID MyServiceModel:: ResumeService ()
(
/ / PauseService = FALSE;
/ / ResumeThread (threadHandle);
Return;
)
/ *
Functionãƒãƒ¼Thul Moses Arabicス
Static
Visibility private
メソAllah tribe were PauseService
Reply few
Notã—
Back than value
Notã—
Note
Pauses the service
* /
VOID MyServiceModel:: PauseService ()
(
/ / PauseService = TRUE;
/ / SuspendThread (threadHandle);
Return;
)
/ *
Function ended Moses Arabicス
Static
Visibility private
メソof Allah Ad
Reply few
Hornラメconcert notã—
Back than value
Notã—
Note
Stops the service by allowing ServiceMain to complete
* /
VOID MyServiceModel:: StopService ()
(
RunningService = FALSE;
/ / Set the event that is holding ServiceMain
/ / So that ServiceMain can return
SetEvent (terminateEvent);
)
/ *
Allah Adスbrowser function of the Commissioner
Static
Visibility private
メソAllah tribe were ServiceThread
Reply few
Hornラメconcert LPDWORD param
Back than value
0
Note
Notã—
* /
DWORD WINAPI ServiceThread (LPDWORD param)
(
/ / Ad Pharaoh Pharaohインmake their
ObjApp.CreateSvcWindow ();
Return 0;
)
/ *
Adインfunction Pharaoh Pharaoh make their
Static
Visibility private
メソAllah tribe were CreateSvcWindow
Reply few
Hornラメconcert notã—
Back than value
Notã—
Note
Notã—
* /
BOOL MyServiceModel:: CreateSvcWindow ()
(
/ / Ad Pharaoh Pharaohインmake their
/ / The handle of the windows
HWND hwnd;
/ / The struct of the WNDCALSS
WNDCLASS wc;
MSG msg;
HINSTANCE hInstance = (HINSTANCE):: GetModuleHandle (NULL);
Wc.style = CS_VREDRAW | CS_HREDRAW;
Wc.lpfnWndProc = (WNDPROC) (_WndProc);
Wc.cbClsExtra = 0;
Wc.cbWndExtra = 0;
Wc.hInstance = hInstance;
Wc.hIcon = LoadIcon (hInstance, IDI_APPLICATION);
Wc.hCursor = LoadCursor (NULL, IDC_ARROW);
Wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
Wc.lpszMenuName = NULL;
Wc.lpszClassName = "PDFMainSvcWindow";
/ / Register the windows class
ATOM aaa = RegisterClass (& wc);
If (aaa == 0)
(
Cout << "RegisterClass Error:" <<GETLASTERROR () <<ENDL;
)
/ / Ad Pharaoh Pharaohインmake their
Hwnd = CreateWindow (
"PDFMainSvcWindow"
"メインMoses ArabicインAdスPharaoh Pharaoh"
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
HInstance,
NULL
);
If (! Hwnd)
Return FALSE;
ShowWindow (hwnd, SW_SHOWNORMAL);
UpdateWindow (hwnd);
HCMain_seivice_data = hwnd;
/ / Back to their first concert whoイSolomon was set and the earth.
SetTimer (hwnd, TIMER_SYS_ID, TIMER_ELAPSE_VALUE, NULL);
/ /メAllah Centerーjinn folk of their start. However,
While (GetMessage (& msg, NULL, 0, 0))
(
TranslateMessage (& msg);
DispatchMessage (& msg);
)
/ / While (1) ();
Return FALSE;
)
/ *
Function Moses Arabicスメイン
Static
Public visibility
メソAllah tribe were ServiceMain
Reply few
Reply of their number [IN] argc DWORD notã—
Reply of the [IN] [] * argv TCHAR notã—
Back than value
Notã—
Note
DamascoンLot mouths the Criterion Hornãƒremember Moses in Arabic. HoweverスAllah commandedケーtreesョンwho opened him, Moses Arabicスhave chosen Ze and do [start] Allah who commanded Talk Talkã—when you Lo, from SCM summon slain.
Moses Arabicスtheirメインdeal with wrong-doers:
* /
Void WINAPI MyServiceModel:: _ServiceMain (DWORD argc, TCHAR * argv [])
(
ObjApp.ServiceMain (argc, argv);
)
/ *
Function Moses ArabicスperfectedンLot mouths the Criterion HaンAd Allah
Static
Public visibility
メソAllah tribe were ServiceControlHandler
Reply few
State perfected the tribe [IN] contorlCode DWORD notã—
Back than value
Notã—
Note
"SCM when Moses ArabicスtheirスSeteーwho in concertスthan you, you stop soon stop whatever 1:00 of the command who Moses ArabicスLo things not for the delivery from SCM summon slain.
SCM is Handler Lo, the truth will speak of their treatment table! Types who deal with the tribe who Damasco crossingã—me.
1. Moses Arabicスstop to notice when you occasions, Moses Arabic Loスstop a Change
2. Stop dealing with wrong-doers (ServiceMain Lo who stop notice)
3. Their occasions And he is not what Had "
* /
Void WINAPI MyServiceModel:: _ServiceControlHandler (DWORD contorlCode)
(
ObjApp.ServiceControlHandler (contorlCode);
)
/ *
Adインfunction Pharaoh Pharaoh. However mouths treesーjinnャ
Static
Public visibility
メソAllah tribe of WndProc
Reply few
Pharaoh PharaohインSad Sad HaンAL-[IN] hDlg HWND notã—
メAllah Centerーjinn [IN] Msg UINT notã—
Hornラメconcert 1 [IN] wParam WPARAM notã—
Hornラメconcert 2 [IN] lParam LPARAM notã—
Back than value
LRESULT
Note
"Pharaoh PharaohインAdメAllah Centerーjinn their analytical processing wrong-doers
* /
LRESULT CALLBACK MyServiceModel:: _WndProc (HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
(
Return objApp.WndProc (hDlg, Msg, wParam, lParam);
)
Tags: framework, the framework








0 Comments to “Using C + + Windows services for the preparation of the general framework”
No Comments. Send your comment.
Leave a Reply
You must be logged in to post a comment.