|
Kiosk software would be one such example.
|
|
|
|
|
Yes, you would most definitely not want a kiosk to hibernate. But I don't see how that relates to the OP's request. I understood it to mean he wanted to keep a machine, that is configured TO hibernate, FROM hibernating. A kiosk does not fit that description.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Well, it would certainly make deployment easier... Just load the kiosk software, when running, it makes sure the computer settings don't interrupt it, when not running...works as a regular computer.
|
|
|
|
|
the problem arises that the device i m working with stops responding..
so as my client requires this functionality to continue altogether when the system resumes from hibernate.. or he asked that the system should not go into hibernate.. since there is nothing we can do with the device hence stopping the windows from entering hibernate was the best option..
|
|
|
|
|
Hi,
Are you making a single call to the SetThreadExecutionState function[^]? The NT kernel tracks how long the user has been idle... by keeping track of the last time the mouse/keyboard has been used or last time it recieved any type of HID input.
When you make that call to SetThreadExecutionState[^]... all it does it set the idle time back to zero. You need to call it over and over again to continuously reset the user idle-count.
I recommend the following:
1.) Make your call to SetThreadExecutionState[^].
2.) Then use the the CallNtPowerInformation function[^] with the SystemPowerInformation index and populate a SYSTEM_POWER_INFORMATION structure[^].
3.) Read the unsigned long SYSTEM_POWER_INFORMATION.TimeRemaining which represents seconds remaining before the user is considered idle and save it.
4.) Begin a window,thread or multimedia timer with a period less than the TimeRemaining you obtained in the previous step.
5.) When your timer fires... call the SetThreadExecutionState function[^] again.
Laptop manufacturers have been known to write device drivers that interfere with preventing hibernation from usermode so your mileage may vary. Preventing hibernation from usermode could be considered a hostile act...
Best Wishes,
-David Delaune
|
|
|
|
|
That's the client side requirement so this wont be a hostile act..
and this code wont allow window to any state.. system will be continuously ON in windows 7
|
|
|
|
|
can't you just disable hibernation from the OS's power settings ?
seems cleaner than trying to do it from an application.
|
|
|
|
|
Juts disable it by schemes
code had been posted many times on pro win32 group
news://nntp.aioe.org/comp.os.ms-windows.programmer.win32
or http://tinyurl.com/cmhb5g by Google
|
|
|
|
|
how we can change array length in c and c++?
for example: dose the programmer have to dispose the allocated memory and reallocate a new space in memory or the own language do this?
thanks if gimme a good document about it.
I need the answer in design programming language scope.
thanks so much.
|
|
|
|
|
desatir7316 wrote: dose the programmer have to dispose the allocated memory and reallocate a new space
Yes.
See here[^] for details about the C++ language.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
In C programming language:
If you allocate the array on the stack then you cannot change its size.
On the other hand, if you allocate an array on the heap (using, for instance malloc ) then you may change the size calling realloc .
All the above rules hold for C++. However you usually use the new operator for allocating arrays on the heap and new lacks of a reallocating mechanism. Anyway C++ provides, via the STL library, containers[^] that take care about memory reallocation.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: In C programming language:
If you allocate the array on the stack then you cannot change its size.
Heh, don't forget about that Microsoft non-standard _malloca[^] beast that was added to the CRT a few years ago.
-Dave the Nitpicker. 
|
|
|
|
|
Hey man, if it is Microsoft then it is 'the standard'!
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
The first thing I thought of was realloc() , but then I got a twinge in my side and remembered this.
If you are using C++, consider a container. Your friends will thank you for it.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Very good link.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Unfortunaltely C/C++ does not allow programmer to use something similar to Delphi's setlength procedure, so that array once set length cannot be resized. When u want to resize, u must declare new array with bigger size, copy elements from old to new, delete old array. So therefore STL has some classes-containers, most often used by me is a list (from #include (list))
Read about list, vector, map, check Google
|
|
|
|
|
hello
what is difference between these assigning values for "a" and "b" ?
class c1{
int a;
int b;
c1():b(0){
a=3;
}
}
thanks a lot
|
|
|
|
|
b is assigned first, since class initialising is executed before the constructor body. This is also the only place where you can assign a value to a non-static const or reference member variable.
|
|
|
|
|
See here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
hi there
can someone say what is the answer of this piece of code
by the way it is so important that why this answer made by the code in Programming language's scope
tnx
union U{
struct S{
shortint x;
shortint y;
}
float f;
long l;
}u1;
u1.S.x=3;
u1.s.y=4;
cout<<f;
cout<<l;
|
|
|
|
|
The answers will most likely be garbage as the code refers to three different types in the same piece of memory. The float and long values will not have been initialised properly.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Your code is utterly broken. A more compiler-friendly one could be:
#include <iostream>
using namespace std;
union U
{
struct S
{
short int x;
short int y;
}s;
float f;
long l;
} u1;
int main()
{
u1.s.x=3;
u1.s.y=4;
cout << u1.f << endl;
cout << u1.l << endl;
}
Now let's have a look at the u1 memory layout (at least on my 32 bit machine):
ADDR 00 01 02 03
VALUE 03 00 04 00
where addresses are relative to &u1 .
Since the (my) machine is little endian, we have the following bit configuration
BYTES 0 0 0 4 0 0 0 3
BITS 0000 0000 0000 0100 0000 0000 0000 0011
That is, for the float member,
SIGN 0
EXP 0
MANTISSA 00001000000000000000011
That is a denormalized float (see here[^]) with value
(2^-5 + 2^-22 + 2^-23) * 2^-126 = 3.6735039242275079514265571025945 * 10^-40
that looks similar to the program output: 3.67346E-040
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Excellent answer.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Thank you, Richard.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
While C.Pallini's response may be correct, there is no guarantee, as the internal format of float is not defined by the standard and therefore compiler-specific! There may even be compiler options to use a specific representation, so the result may change depending on those options.
Also the standard does not specify that long is a 32 bit type, only that it must be at least 32 bit. While I know of no compiler that does this*, any compiler is free to use more than 32 bits, especially when the OS is not 32 bit! If for instance long were a 64 bit type, the value of l would be 3*2^48+4*2^32 , which is a lot bigger than 3*2^16+4 in case of a 32 bit long type.
*compilers that support bigger than 32 bit integer types usually provide them by different names, such as 'long long ' or '__int64 ', rather than just 'long '
|
|
|
|