Click here to Skip to main content
15,902,299 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to highlight items in CTreeCtrl? Pin
Charles Liu22-Apr-03 18:40
Charles Liu22-Apr-03 18:40 
AnswerRe: How to highlight items in CTreeCtrl? Pin
Anonymous22-Apr-03 20:13
Anonymous22-Apr-03 20:13 
GeneralHighlight items in CTreeCtrl Pin
Charles Liu22-Apr-03 18:37
Charles Liu22-Apr-03 18:37 
GeneralRe: Highlight items in CTreeCtrl Pin
Rage22-Apr-03 20:29
professionalRage22-Apr-03 20:29 
GeneralAny body know error 1053 while starting service. Pin
harinath22-Apr-03 18:17
professionalharinath22-Apr-03 18:17 
GeneralRe: Any body know error 1053 while starting service. Pin
harinath22-Apr-03 18:48
professionalharinath22-Apr-03 18:48 
GeneralRe: Any body know error 1053 while starting service. Pin
Anders Molin23-Apr-03 0:56
professionalAnders Molin23-Apr-03 0:56 
GeneralRe: Any body know error 1053 while starting service. Pin
harinath23-Apr-03 1:31
professionalharinath23-Apr-03 1:31 
well, Thank you very much for your help. I understood the logic.
But where should i do that? let me put the question in other way. see the following is my code for starting the service (i took it from msdn)
<br />
DWORD StartSampleService(SC_HANDLE schSCManager) <br />
{ <br />
    SERVICE_STATUS ssStatus; <br />
    DWORD dwOldCheckPoint; <br />
    DWORD dwStartTickCount;<br />
    DWORD dwWaitTime;<br />
    DWORD dwStatus;<br />
 	SC_HANDLE schService;<br />
	CString cstrMessage,cstrCaption;<br />
	cstrCaption="Service Message";<br />
<br />
	char ServiceName[50];<br />
	LPCTSTR lpszServiceName;<br />
	cout<<"Enter the Name of the service:      ";<br />
		cin>>ServiceName;<br />
	lpszServiceName=(LPCTSTR)ServiceName;<br />
<br />
<br />
schService = OpenService( <br />
	schSCManager,          // SCM database <br />
	lpszServiceName,          // service name Here I gave my sample service, Please change this<br />
	SERVICE_ALL_ACCESS);    //according to your wish.. see that the service is in not running currently. <br />
 <br />
    if (schService == NULL) <br />
    { <br />
		cstrMessage="OpenService";<br />
     //  MessageBox(NULL,cstrMessage,cstrCaption,NULL);<br />
	   cout<<"Error code "<<GetLastError()<<endl;<br />
    }<br />
 <br />
    if (!StartService(<br />
            schService,  // handle to service <br />
            0,           // number of arguments <br />
            NULL) )      // no arguments <br />
    {<br />
        	cstrMessage="OpenService";<br />
		//	MessageBox(NULL,cstrMessage,cstrCaption,NULL);<br />
			cout<<"Error code "<<GetLastError()<<endl;<br />
    }<br />
    else <br />
    {<br />
         <br />
			cstrMessage="Service start pending.\n";<br />
            //MessageBox(NULL,cstrMessage,cstrCaption,NULL);<br />
	    	cout<<"Error code "<<GetLastError()<<endl;<br />
    }<br />
 <br />
    // Check the status until the service is no longer start pending. <br />
 <br />
    if (!QueryServiceStatus( <br />
            schService,   // handle to service <br />
            &ssStatus) )  // address of status information structure<br />
    {<br />
        cout<<"QueryServiceStatus"<<endl; <br />
		cout<<"Error code "<<GetLastError()<<endl;<br />
    }<br />
 <br />
    // Save the tick count and initial checkpoint.<br />
<br />
    dwStartTickCount = GetTickCount();<br />
    dwOldCheckPoint = ssStatus.dwCheckPoint;<br />
<br />
    while (ssStatus.dwCurrentState == SERVICE_START_PENDING) <br />
    { <br />
        // Do not wait longer than the wait hint. A good interval is <br />
        // one tenth the wait hint, but no less than 1 second and no <br />
        // more than 10 seconds. <br />
 <br />
        dwWaitTime = ssStatus.dwWaitHint / 10;<br />
<br />
        if( dwWaitTime < 1000 )<br />
            dwWaitTime = 1000;<br />
        else if ( dwWaitTime > 10000 )<br />
            dwWaitTime = 10000;<br />
<br />
        Sleep( dwWaitTime );<br />
<br />
        // Check the status again. <br />
 <br />
        if (!QueryServiceStatus( <br />
                schService,   // handle to service <br />
                &ssStatus) )  // address of structure<br />
            break; <br />
 <br />
        if ( ssStatus.dwCheckPoint > dwOldCheckPoint )<br />
        {<br />
            // The service is making progress.<br />
<br />
            dwStartTickCount = GetTickCount();<br />
            dwOldCheckPoint = ssStatus.dwCheckPoint;<br />
        }<br />
        else<br />
        {<br />
            if(GetTickCount()-dwStartTickCount > ssStatus.dwWaitHint)<br />
            {<br />
                // No progress made within the wait hint<br />
                break;<br />
            }<br />
        }<br />
    } <br />
<br />
    if (ssStatus.dwCurrentState == SERVICE_RUNNING) <br />
    {<br />
	<br />
		cstrMessage="StartService SUCCESS.\n";<br />
	  // MessageBox(NULL,cstrMessage,cstrCaption,NULL);<br />
	 <br />
        dwStatus = NO_ERROR;<br />
    }<br />
    else <br />
    { <br />
       cstrMessage="\nService not started. \n";;<br />
	  // MessageBox(NULL,cstrMessage,cstrCaption,NULL);<br />
	   cout<<" Current State : "<<ssStatus.dwCurrentState<<endl; <br />
       cout<<"Exit Code: "<<ssStatus.dwWin32ExitCode<<endl; <br />
       cout<<" Service Specific Exit Code:"<<ssStatus.dwServiceSpecificExitCode<<endl; <br />
       cout<<"  Check Point: "<<ssStatus.dwCheckPoint<<endl; <br />
       cout<<" Wait Hint :"<<ssStatus.dwWaitHint<<endl; <br />
       dwStatus = GetLastError();<br />
    } <br />
 <br />
    CloseServiceHandle(schService); <br />
    return dwStatus;<br />
<br />
<br />
}<br />
<br />


where should i do the changes?
any further help?
thank you very much again.

cheers
harinath

Harinath Mallepally
HOneywell Technology Solutions Lab,
Bangalore,
India-560076
GeneralMatrices Pin
Albedo22-Apr-03 16:42
Albedo22-Apr-03 16:42 
GeneralRe: Matrices Pin
imsniper23-Apr-03 0:00
imsniper23-Apr-03 0:00 
GeneralRe: Matrices Pin
Albedo23-Apr-03 3:29
Albedo23-Apr-03 3:29 
GeneralRe: Matrices Pin
David Chamberlain23-Apr-03 9:28
David Chamberlain23-Apr-03 9:28 
GeneralData packing libraries Pin
progman22-Apr-03 13:50
progman22-Apr-03 13:50 
GeneralRe: Data packing libraries Pin
imsniper23-Apr-03 21:34
imsniper23-Apr-03 21:34 
GeneralProblem drawing icon with shadow in XP Pin
Mathias S.22-Apr-03 13:22
Mathias S.22-Apr-03 13:22 
GeneralRe: Problem drawing icon with shadow in XP - Solved! Pin
Mathias S.22-Apr-03 22:29
Mathias S.22-Apr-03 22:29 
Generalfloat number comparision Pin
act_x22-Apr-03 11:52
act_x22-Apr-03 11:52 
GeneralRe: float number comparision Pin
Maximilien22-Apr-03 12:03
Maximilien22-Apr-03 12:03 
GeneralRe: float number comparision Pin
Anonymous22-Apr-03 12:21
Anonymous22-Apr-03 12:21 
GeneralRe: float number comparision Pin
Phil Hamer22-Apr-03 16:09
Phil Hamer22-Apr-03 16:09 
GeneralRe: float number comparision Pin
Anonymous22-Apr-03 16:03
Anonymous22-Apr-03 16:03 
GeneralOnContextMenu Shows up without text Pin
allcodeluver22-Apr-03 11:14
allcodeluver22-Apr-03 11:14 
GeneralRe: OnContextMenu Shows up without text Pin
valikac22-Apr-03 11:56
valikac22-Apr-03 11:56 
GeneralRe: OnContextMenu Shows up without text Pin
allcodeluver23-Apr-03 4:26
allcodeluver23-Apr-03 4:26 
GeneralWinsock Problems Pin
Ken Mazaika22-Apr-03 10:51
Ken Mazaika22-Apr-03 10:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.