|
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
|
|
|
|
|
i do recieve a valid data but when i use Hyper Terminal and configure it to recieve data from the balance it give one value not repeated .
the balance sends data continousely but in my program
i read the data and write it in the recieved Text Box
this program i used it with Toledo Balance the program works very well and the read data not repeated
i think three is something must be done !!!!
|
|
|
|
|
Let me guess a little bit.
Your balance is sending data continuously as CR terminated lines (C style syntax, \r is CR):
*) 13600 kg\r*) 13600 kg\r*) 13600 kg\r
Because the lines are only CR terminated (not CR-LF), Hyperterminal will not print the next data set on a new line but overwrite the current one. That is: You did not see what you get. This can be changed by configuring HyperTerminal:
Properties (for active connection) - Configuration tab - ASCII configuration button - Append line feed at end of line upon receiving check box (I tried to translate the names from my local version of HyperTerminal). When enabling this option, you will also see repeated data in HyperTerminal.
What you can do is configuring the balance (disable continuous mode, optional enable sending CR-LF with each line) or write code that can handle the data.
To receive such data, your code should read and store the serial bytes until a CR is received. When this happens, copy the string to the text box and resume receiving.
|
|
|
|
|
thanks ENG. Jochen Arndt for your interest
look eng. Jochen
i want to read only one value that is express the balance reading and i want to use this reading
after that to a bussiness application which i developed using PowerBuilder 10.5
i am a powerBuilder Programmer and my experience in c++ is less than powerBuider
i search for a progarm to read from serial port and i found this program
i have changed the program to call a powerbuilder function that i send the read data to it
the program works very well with Toledo Balance as i mentioned and i install the program in a site which contain Toledo Balance
Toledo Balance also send data continousely but i get only on reading
but the iq plus make the problem as i expalined
i want you to give me a hand in the C++ Program if there is someting wrong
|
|
|
|
|
I had a look on the sources of the example program: It reads all available serial data and puts them to the edit box. But you are only interested in a single line. So you must modify the code to get the parts you want.
A quick and dirty solution would be truncating the received data at the first CR or LF byte and stop receiving. A better solution would be doing this inside the thread using a buffer that is overwritten with each new line and provide some data exchange mechanism between the receiving thread and your application's main thread.
|
|
|
|
|
dear eng:Jochen Arndt
i am trying your idea now
but the problem still happen
would you please give me hand ?
|
|
|
|