|
Calling
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED);
should prevent the system from entering the sleep mode.
Waking a system up requires that the user initiates a wake-up event like pressing the power button, a keyboard key, or moving the mouse.
|
|
|
|
|
Jochen Arndt wrote: Calling
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED);
should prevent the system from entering the sleep mode.
Its not working in my code..Is there any other method or trick to call it?
Jochen Arndt wrote: Waking a system up requires that the user initiates a wake-up event like pressing the power button, a keyboard key, or moving the mouse.
I want to do it programmatically. Will you suggest something?
|
|
|
|
|
Indian Coder1989 wrote: Its not working in my code..Is there any other method or trick to call it? This is the only way I know. It may help to repeat the call in regular intervals (e.g every 5 minutes).
Indian Coder1989 wrote: I want to do it programmatically. Will you suggest something? There is nothing to suggest because the CPU is usually not powered or in halt state when the system is in sleep mode. There must be an external event to wake-up.
|
|
|
|
|
Jochen Arndt wrote: This is the only way I know. It may help to repeat the call in regular intervals (e.g every 5 minutes).
I made it using a timer and its working now.
Can I do it for a period of time for which my application is running?
Because its only working on a period of my timer.
|
|
|
|
|
I did not really understand what you mean now. Normally, the system should not go to sleep when an application has requested this until the application terminates or clears the state.
But these links may be helpful:
System Sleep Criteria[^]
System Wake-up Events[^]
|
|
|
|
|
Hi, i want to create a code which detect the face in a cercle and put a message indicating the rotation angle of the face or its direction. In fact, my code can just detect the face. The problem that i couldn't found its directions. I'm using win32 console application. can someone help me ?
Thanks !
|
|
|
|
|
|
|
hi all,
I am count the editbox character on ON_EN_CHANGE of edit control,
when count is 50 show a message box,
its works fine when I type in edit box,
but the problem arise,when I paste the content in editbox and the count is 50,now the messagebox is popup but at this time COPY, PASTE function not working in whole system.
please help me what can I do?
thank in advance.
|
|
|
|
|
Le@rner wrote: the messagebox is popup but at this time COPY, PASTE function not working in whole system. What exactly does that mean? It's unlikely that showing a message box could disable these functions unless your code is doing something illegal.
Use the best guess
|
|
|
|
|
1 Is the problem present, if message box is still opened?
2 Or Is the problem present even after closing message box?
If 1 is true and 2 not, I think that you have blocked system clipboard with your message box. You opened modal dialog (msgbox) during OnPaste msg and it cannot finish it's work untill messagebox is closed. If it cannot finish it's work, the system clipboard cannot be released. If clipboard is not released, the ctrl+c, ctrl+v doesn't work in whole system.
|
|
|
|
|
yes option 1 occur here "the problem present, if message box is still opened?"
how can I resole this, any idea for this, can I use modeless dialog for this.
thanks.
|
|
|
|
|
Hi, all!
I am a rookie about C/C++,when i debugged my project, i met a problem about 1.#IND, and the code is as followed:
h = x2-x1;
a = M1 * pow((x2-x),3);
b = M2 * pow((x-x1),3);
f = M1*h*h;
g = M2*h*h;
temp1 = 6.0*y1 - f;
temp2 = x2-x;
c = temp1 * temp2;
cc = (double)((6.0 * y1 - f)) * (double)((x2 - x));
I have defined all the variables as double, and i think the values of c and cc should be the same, but i found that the variable c got the right value, but the variable cc get the value of "-1.#IND". And what is the strangest? the whole compute above is run in a for loop, the cc only get the -1.#IND when the first time i get into the loop, and then the cc will get right and the same as c value. If i deleted the compute about cc, then the next line of code about other compute will get a -1.#IND for once time.
i am really comfused!!!
is there any master hand had met the same problem or know that is why?
|
|
|
|
|
This usually happens for an illegal floating point operation like 0/0.
As you said, if it is consistently happening the first time, you can single step through the code in the debugger and check the values of the variables for the code that produces this error.
|
|
|
|
|
Hello, i tried step single and found it was the cc value get the -1.#IND. and the temp1 and temp2 used get the value of c are all right, and the c is right too.
|
|
|
|
|
It would help if you could post the values of the variables x, x2, f and y1 when you get -1.#IND output.
|
|
|
|
|
Hello, i have got the values of the variables:
y1 = 2458.210000000000000;
f = 0.000000000000000;
x2 = 62.478044143522851;
x = 0.000000000000000;
i do not know does the "6.0" play some bad role in the computing.
|
|
|
|
|
With these values, the equation to return cc give me the correct value of 921504.91736429580.
|
|
|
|
|
I am sorry, i think i forget to describe the situation i use these code. These code is part of my project which export a dll file. And i call this dll in another program for three times during calculate every step, and give the dll different parameters for every time calling. the code above is a part of an internal function, and the f is a local variable, y1, x2 are the input parameters, x is the output parameter with the input format using &x. the first and second times i call these internal function, the cc gets right result, but during my third time call the internal function, the cc gets -1.#IND.
My English is not well, and i do not know whether i described the situation clearly. thank you
|
|
|
|
|
Hi, I think i have find the where the bug is. As there are four projects in my solusion, and there is a function which is used in different projects, but the function is only declaerated in one of the project. Eventhough i can get into the code during my single step, but i can not go to its defination in the project in which there is no defination or declaration for this function. so i think that is because the function's entry is wrong during the calculate that due to the -1.#IND.
thanks a lot for your help and suggestion!
good luck!
|
|
|
|
|
Hi,
I am still having problems with my TCP/IP connection as I get a timeout notification in my OnConnect overridable
I have a few questions
1) do the Socket and Bind Function do the same as Create ?
2) Would using the SetSockOpt SO_KEEPALIVE options help ?
3) could someone give a example of the C++ syntax for using the SOCKET operator in obtaining the socket handle
Thanks
|
|
|
|
|
Provide the code snippet of Client that make connect request and code snippet that listens on a port xyz. With that people can help you.
|
|
|
|
|
I have 4 CAsyncSocket derived classes wrapped inside 4 Derived CWinThread Class
in the CWinThread::Initinstance I set the ipaddr = "192.168.1.4"
When I use NULL as the last parameter in the CAsynSocket::create or BIND I am successful in creating
a socket however when I use the ipaddr "192.168.1.4" the ipaddr of the machine I get
WSAEADDRNOTAVAIL
The listening code is MainFrame Assembler EZASMI select which is intended to process multiple I/O's
on multiple sockets
EZASMI TYPE=SELECT, Issue Macro
MAXSOC=MAXSOC1, SPECIFY MAXIMUM NUMBER OF SOCKETS
TIMEOUT=TIMEVAL,
RSNDMSK=RSNDMSK, READ MASK
RRETMSK=RRETMSK, RETURN FROM READ
WSNDMSK=WSNDMSK, WRITE MASK
WRETMSK=WRETMSK, RETURN FROM WRITE
ESNDMSK=ESNDMSK,
ERETMSK=ERETMSK,
ERRNO=ERRNO, (Specify ERRNO field)
RETCODE=RETCODE, (Specify RETCODE field)
ECB=MY_ECB, MAIN TASK EMB
ERROR=ERROR, Abend if Macro error
TASK=MYTIE,
MF=(E,MY_PARM)
thisocket.Socket(SOCK_STREAM,FD_READ|FD_WRITE|FD_CONNECT,NULL,AF_INET);
if(thisocket.Bind(thisocket.port,ipaddr) == 0)
error_code = GetLastError();
thisocket.GetSockOpt(SO_KEEPALIVE | SO_DEBUG, &thisocket.option,val_ptr, SOL_SOCKET);
if(thisocket.SetSockOpt(SO_KEEPALIVE | SO_DEBUG, &thisocket.option,val, SOL_SOCKET) == 0)
error_code = GetLastError();
|
|
|
|
|
i download this program from the following link
http://www.codeproject.com/Articles/3061/Creating-a-Serial-communication-on-Win32
i use this program with a balance indicator connecting to the serial port
the program working very well with a type of balance which is Toledo but when using the program with balance
indicator of IQ plus 710 of company ricelake
the read from the indicator repeated
like this
*) 13600 kg *) 13600 kg *) 13600 kg
in the configuration of the indicatore there is not a parameter value of the number of stop bits
what can be the problem ???????????
in the code of C++ i have a variable for the number of stop bits
configSerial_.ByteSize = 7;
configSerial_.StopBits = ONESTOPBIT;
configSerial_.Parity = EVENPARITY;
would you please give me the help for the true setting of paramters
|
|
|
|
|
If you receive valid data (and '13600 kg' looks valid), your serial parameters are correct. The data are repeated because the balance sends them. A quick search finds the manual[^] that states on page 70:
Quote: If continuous transmission is configured for the EDP
or printer port (STREAM parameter on the SERIAL
menu), the IQ plus 710 sends data using the
Consolidated Controls serial data format shown in
Figure 10-1
|
|
|
|