|
If you stop the service you need to restart it. The SCM will only start 'automatic' services when Windows is starting up or if another dependent serice is trying to start. At other times, you need to start it yourself.
When adjusting the service properties, I see a 'Recovery' tab in the dialog. It seems the default recovery options are to 'do nothing'. One of the choices is 'Restart Service'. Maybe you can try adjusting the options to see if you obtain a desired result.
|
|
|
|
|
Yeah, the "Recovery" options is what I meant by "set preferences" in my previous post. The "Restart" option works well when the service is killed, but restart doesn't seem to work when the service hangs during its start phase, even though I was led to believe that the SCM would kill a service unable to start up.
Rodney
|
|
|
|
|
I would have beleived the same thing, based upon all the MS documentation.
They would make you think your service is going to suffer hellfire and damnation if it does not report 'service start pending' periodically to the SCM during start up. And now your testing makes it look like the SCM does not do anything (except maybe report the service is hung or failed to start, to the event logger.
Regardless of recovery options settings, it seems your service is not killed and restarted. That sucks 
|
|
|
|
|
I used the code below to create a slider control. I tried to put the code into another initialize function of my own but it wouldnt work. Can the code be put into another function?
What I really dont understand is why do I need to include:
CDialog::OnInitDialog()...to make the project run? Without it I get a run time error condition.
Jerry
/////////////////////////////////////////////////////////////Create slider control here
BOOL dialogWnd::OnInitDialog()
{
CDialog::OnInitDialog();
CWnd* pWnd = GetDlgItem(IDC_SLIDER1);
CRect rect;
pWnd->GetWindowRect( &rect );
ScreenToClient( &rect );
m_Slider.Create( WS_VISIBLE|WS_CHILD|TBS_HORZ, rect, this, IDC_SLIDER1 );
return TRUE;
}
|
|
|
|
|
Is your question why does OnInitDialog() exist or why you call it there ?
OnInitdialog contains initialisation code that is required by a number of functions such as Create() and DoModal().
As to why call it, your derived OnInitDialog() must call the base class function to use this code. It's that or write it again yourself.
Elaine
The tigress is here 
|
|
|
|
|
The bigger question is why are you creating the slider control at run-time?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I wasnt sure how else to do it. I have many objects of type dlg that may or may not contain a dialog with a slider. I was attempting to create a slider dynamically only if the dialog window needed it...depending on the requirements. I dont know if I am explaining it very well, but thanks for your help.
Jerry
|
|
|
|
|
There are a few situations where a control created at run-time makes sense but this is not one of them. Add the control to the dialog's template, create a member control variable for it, and then put the following in the dialog's OnInitDialog() method:
BOOL dialogWnd::OnInitDialog()
{
CDialog::OnInitDialog();
if (some_condition)
{
m_Slider.ShowWindow(SW_SHOWNORMAL);
m_Slider.EnableWindow(TRUE);
}
else if (some_other_condition)
{
m_Slider.ShowWindow(SW_HIDE);
m_Slider.EnableWindow(FALSE);
}
return TRUE;
} Why disable a hidden control? Some folks assume that once a control is hidden, it can no longer be interacted with. Wrong. A hidden control can still receive input focus, even if you can't see it.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thanks...I am a SW Eng and sometimes I really struggle with MFC. Is there a place where I can get a sample dialog program that really explains all the intricate details of what is going on?? I like stepping through all the code to really understand what is happening.
You gave me some good ideas...
Have a good day.
Jerry
|
|
|
|
|
jerry1211a wrote:
Is there a place where I can get a sample dialog program that really explains all the intricate details of what is going on??
Just keep plugging away at it. Come up with a (small) problem, and then create a little application to solve it.
When I started using MFC back in 1993, I created dialog-based applications exclusively. The concept of a document and a view made no sense to me. It was not until the late 90s that the light bulb came on. Once I had a grasp of what role the document and view played, it opened up other possibilities.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Ok sounds like a good plan.
Jerry
|
|
|
|
|
Is it valid to create document in one process and get node info in another process. What pointer I need to pass. I think pointer to COM object or interface are local process.
Thanks.
We yesterday got drunk with Bacchus ...
|
|
|
|
|
Do I need to marshal XMLDOMDocument pointer?
We yesterday got drunk with Bacchus ...
|
|
|
|
|
Do anyone have an example code on Winsock2 UDP written in C language for windows XP. Please help
Heaven's on me
|
|
|
|
|
|
<br />
CMenu menu;<br />
CMenu *sub=NULL;<br />
VERIFY(menu.LoadMenu(IDR_MENU));<br />
sub = menu.GetSubMenu(0);<br />
UINT state = sub->GetMenuState(IDC_CHOICE, MF_BYCOMMAND);<br />
ASSERT(state != 0xFFFFFFFF);<br />
if(state & MF_CHECKED)<br />
{<br />
sub->CheckMenuItem(IDC_CHOICE, MF_UNCHECKED);<br />
}<br />
else<br />
sub->CheckMenuItem(IDC_CHOICE, MF_CHECKED);<br />
Why doesn't it check or uncheck my menu item? it remains as it is initially...
|
|
|
|
|
How about:
if (state & MF_CHECKED)
sub->CheckMenuItem(IDC_CHOICE, MF_BYPOSITION | MF_UNCHECKED);
else
sub->CheckMenuItem(IDC_CHOICE, MF_BYPOSITION | MF_CHECKED);
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
nope...but here is the problem...the if works, but CheckMenuItem doesn't...so the first part is good, it sees if the item is checked, but it doesn't change this thing.
|
|
|
|
|
I think I gave you the wrong code. MSDN states that a pop-up menu item must be checked by position since it does not have a menu-item identifier associated with it. Figure out what position IDC_CHOICE is in and use that for the first parameter to CheckMenuItem() .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi!
I have an SDI application which, at a certain moment, creates a child dialog box. Therefore, when the app. is active, this dialog box (which is a popup window) is the active and it's really easy to get a CWnd* to it through GetActiveWindow().
The problem arises when the user switched to another app. (using Alt+tab for example) this function returns NULL. How can I find which window was active before my app. lose focus ?
Thanks for help
|
|
|
|
|
Y.Cohen wrote:
How can I find which window was active before my app. lose focus ?
Check out the WM_ACTIVATE and WM_ACTIVATEAPP messages.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
|
Y.Cohen wrote:
How ?
Like you would any other message or notification:
WM_ACTIVATEAPP
WM_ACTIVATE
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hey,
I have a list View which displays a tool tip on a mouse click. I want to read and save that information. Are there any messages that can be sent to retrieve such information. I have tried TTM_GETTOOLINFO and TTM_GETTEXT but then dont seem to work too well.
Abhishek
|
|
|
|
|
I want to dynamically change my dialog box. For example, if I click a check box I want text to appear or diappear, depending on the value.
Danny
|
|
|
|