|
search for ResOrg here on CP, it's a nice tool made by Anna that helps cleaning up the resources.
|
|
|
|
|
Thanks! I'm checking it out now.
|
|
|
|
|
Hi,
I have a service written in C++. When I get SERVICE_CONTROL_STOP command, I want to check certain condition and if that condition is false then return an error and not stop the service.
In the service control handler function (registered by RegisterServiceCtrlHandler), I have a code which looks as follows:
void service_ctrl(DWORD dwCtrlCode)
{
...
switch(dwCtrlCode)
{
....
case SERVICE_CONTROL_STOP:
if ( CanStop() == FALSE )
{
// stop not allowed.
ssStatus.dwCurrentState = SERVICE_RUNNING;
ssStatus.dwWin32ExitCode = NO_ERROR;
ssStatus.dwCheckPoint = 0;
if (!(fResult = SetServiceStatus(
sshStatusHandle, // service reference handle
&ssStatus))) { // SERVICE_STATUS structure
// LOG SOME ERROR
}
}
else
{
// stop allowed.
....
}
break;
}
...
}
The problem is:
When I stop the service, by running "net stop MyService", it displays "service could not be stopped", the service status remains "started" and this is great.
But when I run "net stop MyService" again, it displays "The service could not be controlled in its present state" and the service status becomes blank.
How should I decline service stop request properly?
|
|
|
|
|
According to the docs:
SERVICE_CONTROL_STOP
Notifies a service that it should stop.
If a service accepts this control code, it must stop upon receipt. After the SCM sends this
control code, it does not send other control codes.
Windows XP/2000: If the service returns NO_ERROR and continues to run, it continues to receive
control codes. This behavior changed starting with Windows Server 2003 and Windows XP SP2.
|
|
|
|
|
i want to extract the pixels 320x320 from the webcam browser on monitor screen and put into the array. Anyone can help me in this problem about the source code or related information?
love-peace-joy
|
|
|
|
|
What's the webcam browser?
There's APIs available for video capture that may give you better results than trying to
scrape the screen.
|
|
|
|
|
Hi All,
I have a dll in vc++( It shows one dialog with some static box and list control) .
Case 1. If i create this by statically linked in project settings and keep mantain it's default settings( with out support unicode)
then it used properly in my project ( Give the desired output)
Case 2. If i create it unicode compatiable by using all unicode liberary in project settings then As i use it into my project and build , my project buid properly but terminate as i execute it. ( My project is also unicode compatiable)
Why it is happening , is there any other way to build the unicode compatiable dll, or any other type of setting other then exe settings.
Thanks
SNAV
|
|
|
|
|
singh_nav wrote: my project buid properly but terminate as i execute
Does this mean , it is crashing ?
Have you tried to debug it ?
|
|
|
|
|
yes i tried to debug it , But it crash before it comes in the App class Init function .
ND
|
|
|
|
|
I have a dll written in C where in the function parameter does not contain any device context.
I want to use that dll to draw in a view or dialog in VC++.
I am able to link the dll and the function returns the correct parameter value but no drawing appears
Can someone help please
mk
|
|
|
|
|
, code ?
|
|
|
|
|
mk79 wrote: C where in the function parameter does not contain any device context
And how do you get your Device Context for drawing?
(i.e. post code please...)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Can you show snippet code
|
|
|
|
|
Hi
How can we find out the difference between dates.Is there any method to find that .please kindely help me.
#sanroop#
|
|
|
|
|
Have you tried using class COleDateTime ,COleDateTimeSpan ?
|
|
|
|
|
Iam very thankful for your raply.I saw all methods in COleDateTime,COleDateTimeSpan here my problem is to find the difference between current date and any otherdate what ever i give.
#sanroop#
|
|
|
|
|
|
Sanroop wrote: ...my problem is to find the difference between current date and any otherdate what ever i give.
Which is what COleDateTimeSpan does, assuming you are using MFC. Otherwise, check out difftime() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
What format are your dates in?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
For converting to FILETIME you may use:
1) LocalFileTimeToFileTime()
2) "Converting a time_t Value to a File Time" article in MSDN
3) DosDateTimeToFileTime()
The FILETIME structure is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).
This time format is the most sensitive I ever met in Windows.
You may just construct an INT64 numbers and subtract them.
Every 10000 units == 1 millisecond (1/1000 second)
So I second contains 1000*10000 units.
Good Luck!
|
|
|
|
|
Hi,
I have a project to do which consists on implementing a solution to make firewalls more dynamic.
The code which I should write it must be integrated in XP firewall, free BSD,... .
How can I find an API compatible with different OS and which can manage firewall rules.
Thanks.
|
|
|
|
|
Search for UPnP. It has limited use in opening and closing ports and manipulating port
forwarding on UPnP-enabled devices.
If firewalls were programmable they'd be kinda useless
|
|
|
|
|
|
From what i've understood, the mainframe title is stored in the string table. How can i change it at runtime?
Here's what i want to do:
Let's say the application title is MyApp. For some reasons it becomes MyApp USERID. Doing this for the main window is easy with setwindowtext, but when i open a document it switches back to MyApp and the title switches from "MyApp USERID" to "My App - Document1"
How do i change it so that it doesn't change back?
|
|
|
|
|
eusto wrote: the mainframe title is stored in the string table.
CDocument::SetTitle . Read the docs too.
|
|
|
|