Sign in to follow this  
Mazh

Win32 Question

Recommended Posts

I'm currently doing some Win32 programming and didn't find anything about the feature I want. I've created 3 "edit" windows to write some values into it and I'd like a tips how to calculate the 3th value automaticaly when I click the "calculate" button. So, I've 3 edit boxex, writing 2 values and want the 3th edit box show me the results into the edit box and vis-versa. I've also thought about making a menu to calculate specific values, the got valuee from the edits and click to the corresponding menu to calculate the missing value to the edit box that needs it. What I wish the most is something that could refresh my windows so this is calculating automatically. But didn't find anything via MSDN, maybe some wrong key-search but.. ^^ I'd also make it so when I hit ENTER, the blank value missing in the edit just appear up too, just another idea. If you need more informations to get it clearly feel free to ask. Thanks for any comments or future help. Cordially, Mazh Edit: How to get string to my value that are into my edit boxes? I mean, when I enter a number into my edit box, how do I retrieve the information to use it to my own? Thanks. [Edited by - Mazh on April 20, 2008 10:49:29 PM]

Share this post


Link to post
Share on other sites
well as for adding the values of 2 edit controls, and placing it into the 3rd, try something like


there's a function that grabs the contents of an Edit, which was mentioned about, GetDlgItemInt()

int NumberOne = GetDlgItemInt(hWnd1); // get values of both edit boxes
int NumberTwo = GetDlgItemInt(hwnd2);

int total = NumberOne + NumberTwo; //add

stringStreamObject << total; //pre-initialized string stream

SetWindowText(hWnd3,stringStreamObject.str().c_str());


that would do the job, as for the pressing enter, try using a button at first

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this