|
|
Mohammadj wrote: Can anyone help me in making it dual function button?!
Probably, but you'll need to post your code snippets here (i.e., only relevant code), rather than require someone to download your whole project from some other site. Some of us have soap operas to watch and Bonbons to eat so time is important.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Welcome to...
Well, you already know [^].
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]
|
|
|
|
|
Here is the code snippet i wrote when the custom button clicked
void CHashiDlg::On_AddSubtract_action()
{
UpdateData( );
double numA ,numB ,result ;
numA = atof(m_num1) ;// edit control number1
numB = atof(m_num2) ;// edit control number2
if(m_two_actions_botn.OnRight()) { // check whether the mouse clicked right half
m_results = numA + numB ;
UpdateData(FALSE );
}
else {
m_results = numA - numB ;
UpdateData(FALSE );
}
UpdateData(FALSE );
}
it performs no action loll
|
|
|
|
|
The first thing I'd do is get rid of those unnecessary UpdateData() calls. They are a never-ending source of problems simply because most folks do not know how to use them.
You should then have something akin to:
void CHashiDlg::On_AddSubtract_action()
{
CString strNumA;
strNumB,
strResult;
m_num1.GetWindowText(strNumA);
m_num2.GetWindowText(strNumB);
double numA = atof(strNumA),
numB = atof(strNumB);
if (m_two_actions_botn.OnRight())
strResult.Format("%f", numA + numB);
else
strResult.Format("%f", numA - numB);
m_results.SetWindowText(strResult);
}
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
|
That tells us a lot.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
|
How could I, or anyone else, possibly know? What have you tried so far? What code do you currently have in place? Does it compile? Are you getting runtime errors (e.g., assertions, exceptions)? Have you used the debugger (and stepped through each line of code in question)?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
no errors
but it performs nothing
loll
|
|
|
|
|
Is On_AddSubtract_action() being called?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
DavidCrow wrote: Is On_AddSubtract_action() being called?
I don't know, but I really appreciate you patience, man.
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]
|
|
|
|
|
Hi
Can you look at the codes i made?
in the project?
|
|
|
|
|
I am reading a huge .txt file which has data arranged in form of rows and columns.
There are 60 columns and 10000 rows and i have to read each data(which is integer or float type) from the file to use it for some purpose.
I am using scanf() to read. But this is taking long time and the program slows down.
how can i improve the speed of reading ??????????
Regards
raghav
|
|
|
|
|
|
You can get more speed if you're ready to use up more memory.
Read the entire file into a CString variable.
And then use CString::Tokenize to read each field.
The CString variable will use up enough memory to load the entire file.
Or you can logically divide the file into fixed size chunks and read one chunk at a time and do the same processing.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Split each line into fields and use atof[^] (to read floats) and atol[^] (to read integers). That should be quicker than scanf.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Raghav0710 wrote: how can i improve the speed of reading ??????????
By not reading one line at a time from disk.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Read the whole thing into memory and parse it. If it's too big, read it in in chunks.
You can make it go even faster by converting the data while parsing.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hello All,
Sorry in advance for the lengthy explanation...
I have two applications (a server and a client) that talk to each other via TCP/IP. (WinXP to WinXP) I've noticed that if the server runs on a relatively poor performing machine and the TCP/IP traffic is high, that TCP/IP will be smart and combined messages to save on network traffic. My server/client are able to handle that just fine; however, I've recently noticed that in certain circumstances, like over a VPN connection where the network performance is degraded, TCP/IP will not only combined packets, but will also split the packets. That is to say where one packet was sent, two are received. In reality what happens is that four are sent and two are received; the first 3 are combined with 1/2 of the fourth and the other half of the fourth is in the second packet. This wouldn't be a problem except I don't know how to know which packets need to be reconnected and in what order. This seems to only occur when a large number of packets are being sent in rapid succession. TCP/IP does not guarantee that the order sent is the order received. The data that is being sent must pieced together in the correct order for it to be useable.
Is this normal behavior and if so, how do you make the connection between packets?
Thanks in advance.
|
|
|
|
|
|
His description sounds more like UDP to me.
|
|
|
|
|
First a book recomendation: Effective TCP/IP Programming: 44 Tips to Improve Your Network Programs[^].
TCP is stream oriented. The order of the bytes going in one side always remains the same when it comes out the other side. At the application level there are no packets. Packets come into play after TCP gets your data and transmits it. It is free to do whatever is needed to get the bytes from one place to another -- split, combine, distribute amongst several homing pigeons, whatever. The bytes can arrive on the other side in any order but they are always reassembled in the sending order prior to presentation to the application.
I'm guessing you are sending messages of specific lengths over the socket and most of the time when you do a write on one side, your read on the other side gets the full message in one chunk. This is not always the case. When the receiver does a read(), all of the bytes in the stream may not have arrived yet and you will come up short or bytes from a following message may have arrived and you will get part of the next message. This is normal. You can't prevent it from happening. Assuming there is a one to one coorespondence between reads and writes is a very common mistake. It usually works when you are on the test bench but when things get busy, it all falls apart.
Typically what is done is to add some structure to your messages. Start them with some sort of Start of Message marker followed by the message length. The receiver reads this header portion and then reads again for the indicated length. The read may come up short in which you have to dip in again waiting for additional bytes. Once length bytes have been read, the next read should be for a message header again and the process repeats.
|
|
|
|
|
Thanks for the very helpful reply. This confirms what I had surmised. I'll check out the book too; I've run into many problems along the way that has been quite frustrating. I'm considering a re-write of the server side in Java for it's cross platform compatibility and so I'd like as much information up front during the design phase.
Thanks again.
|
|
|
|
|
Asking this in regard to Having CAsyncSocket run as a seprate thread from My CDialog Thread
If I need a Window/Control/CWnd Class to process notfications
by I just create COntrol/Cdialog Class and not display the Window
thankx
|
|
|
|