Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


win32/beginner


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 epp289   Members   -  Reputation: 122

Like
Likes
Like

Posted 19 October 2001 - 09:30 AM

Hello. I would like to ask you something on win32 API.I have already downloaded some tutorials from the Internet. I understood the basics. But I found it difficult for me to make a little more complex program. For example I would like to make a simple dialog box in which there are 2 edit boxes where you type 2 numbers. When you press a button then the sum of these 2 numbers must be displayed in a label (or on the title or maybe on buttons’ caption) How I can program it? Help me please

Sponsor:

#2 ncsu121978   Members   -  Reputation: 508

Like
Likes
Like

Posted 19 October 2001 - 09:39 AM

if you are using MSVC....
then create a dialog in the resource editor with the edit boxes and the push button and the label.
Then look into the funcntion
DialogBox(....................);
to create the dialo0g box that you made in the resource editor.
Then look into the SendMessage(..........) function to retrieve information from the dialog box such as the values placed in the edit boxes. Then when you detect that the button was pressed, ,get the values out of the edit boxes with SendMessage(.........), add them together, and place the answer in the label with SendMessage(...........)

"I pity the fool, thug, or soul who tries to take over the world, then goes home crying to his momma."
- Mr. T

#3 Load Runner   Members   -  Reputation: 122

Like
Likes
Like

Posted 19 October 2001 - 11:15 AM

i suggest you look up GetDlgItemText() SetDlgItemText()

#4 EbonySeraph   Members   -  Reputation: 122

Like
Likes
Like

Posted 20 October 2001 - 03:28 PM

You need to call the GetDlgText function(may not be correct spelling and I forget the exact parameters) on both edit boxes and have 2 variables to store these numbers. Then add them and display them using sprintf()[need stdio.h for this] to form a whole string that say something like The sum of so and so is so and so.

If you aren''t familiar with sprintf, here is how you use it:

sprintf(string_to_write_too, "Here is the sum: %d", sum);

That will put the string "Here is the sum: --" and fill in the -- with the actual sum. If you knew how to use printf then that should be familiar to you. Its the only easy way to put numbers in an integer form right into a character string. The %d means that the first parameter after the string will be an integer, and any following %d''s in the string will correspond to additional parameters. Note that you need to use other special characters for other data types.

"Ogun''s Laughter Is No Joke!!!" - Ogun Kills On The Right, A Nigerian Poem.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS