|
Rajesh R Subramanian wrote: What if the VB thing consists 1000+ lines and contains so many GOTO and ON ERROR RESUME NEXT thingies?
Then you ignore the post and move on. A comment to every post, contrary to popular opinion, is not necessary.
Rajesh R Subramanian wrote: My opinion was that the OP could have stated the problem, because she wants to learn Visual C++.
The problem was stated with code. That's good enough for, and easily understood by, most.
Rajesh R Subramanian wrote: Posting some VB code and asking for its Visual C++ equivalent would not teach her anything. Agree?
No, not at all. But then everyone has a right to their own viewpoint. Some folks are capable of learning a great deal by mapping what they know to a new language.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: Some folks are capable of learning a great deal by mapping what they know and are comfortable with to a new language.
I missed that. Thanks for pointing out.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
CPallini wrote: If he need to translate some VB code to C++ then what would be the right forum?
Coding Horrors[^]
|
|
|
|
|
I spurted out tea man. That's it. I need to read CP or drink tea. I can't mix them both.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
hello everyone,
please tell me solution for this problem please. in my program strData is of type CString. so for this i have to find out the middle value and that value should be stored in dout. please help me.
thanku in advance,
savitri
|
|
|
|
|
Hello Guys,
I am using a static text control and i want when the user click on that static text control then the user will able to go to that page which i link.How should be possible it? Please give me any suggestion.
Will we able to use any message maps or events with static text control?
Also i did not want a hyperlink by using the sethyperlink function.
|
|
|
|
|
Did you can set Notify for static control?
|
|
|
|
|
Search CP for "static hyperlink" controls.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
CMyListCtrl::OnClick(NMHDR* pNMHDR, LRESULT* pResult)
And the parent window need to handel NM_CLICK from the list ctrl too.
Now only the handler in CMyListCtrl will be executed.
How to let both handlers work?
Thanks.
|
|
|
|
|
MFC's global message handler will always use the first handler found. That means you have to forward the message to the parent window yourself.
Don't try it, just do it!
|
|
|
|
|
It doesn't work. When I send WM_NOTIFY in the ctrl's notify message handler, it seems that there is a deadlock.
|
|
|
|
|
Just another way, send my msg instead.
|
|
|
|
|
I've been doing some profiling and have come across a portion of my code that I suspect can be sped up (although it is already quite simple). I have a loop where I do a calculation. In this form:
for (int i = max; i >= 0; i--)
for (int j = 0; j <= limit; j++)
value = calculation(i,j);
The loop is blazingly fast. I can do about 20,000 iterations in a fraction of a second. Then I added an if-else block:
for (int i = max; i >= 0; i--) {
for (int j = 0; j <= limit; j++) {
if (quantity > 0)
value = calculation(i,j);
else
value = 0.0;
}
}
In the above form, the 20,000 iterations can take about a minute. Speed is very important and the simple addition of the if-else brings a huge performance hit - I suspect because the compiler can't optimize the loop. Does anyone see a creative way to remove this if-else block and replace it with something the compiler can optimize? It seems it should be simple, but I can't really think of anything off-hand.
modified on Tuesday, March 4, 2008 3:29 AM
|
|
|
|
|
73Zeppelin wrote: for (int i = max; i >= 0; i--) { for (int j = 0; j <= limit; j++) { if (quantity > 0) value = calculation(); else value = 0.0; }}
if(quantity > 0) {
}
else {
}
Maxwell Chen
|
|
|
|
|
Hi Maxwell, thanks. I should have mentioned the calculation is indexed by the loop. I've been thinking of something like:
#define MAX(x,y) ((x)>(y)) ? (x) : (y)
but then I have to calculate x on each iteration so that isn't an improvement.
|
|
|
|
|
if quantity is not i , j dependent then Maxwell suggestion still applies.
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
|
|
|
|
|
Yes, of course! We shouldn't mislead anyone. Good of you to point that out.
|
|
|
|
|
well... assuming that is not a poor example... if quantity is not based on i,j why is it inside a loop? Since value is assigned not summed or similar, only the last value of the loop is stored. You could count backwards and stoop on the first hit and get the same result.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
I am using activex in VC application. It has some connect method which takes User Name and passwords.
When I give user name and password of remote machine or network machine. Connect fucntion gives error : "Invalid Network Credentials".
Does anyone came across this or know what I have to set to by pass this network credentials problem.
Thanks in advance
AmolM
|
|
|
|
|
I want to display a value from the file and display it on the editbox. for example
in the file the time format is something like this
11:06:16:254
now i need to put 11 in one editbox, 06 in the next editbox and so on... that means i will have 4 edit boxes to display the time.
the file format that i have is of .dat extension. i am using mfc for this
please give me some leads.
|
|
|
|
|
You have a problem reading from the file or displaying it on the screen?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
i am able to read the data from a file but i am can display only the last value of the file. i want to display all the values in that file. i have created a timer for that which fires every one sec. what needs to be done to show all the values in the editbox.
|
|
|
|
|
Chandrasekharanp wrote: please give me some leads.
1) research the MFC library documentation for File I/O. This will provide you with the ability to open the file and read data from it.
2) research the MFC documentation for the class CString. This will provide you with solutions for separating the different parts of the time data.
3) Research the MFC CEdit control. This will lead you solutions for displaying the edit controls and setting the data into them.
4) Thank your instructor for giving you such a simple assignment.
led mike
|
|
|
|
|
Priceless[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|