I'm learning C++, but need an example..

This is a discussion on I'm learning C++, but need an example.. within the Windows Programming forums, part of the Platform Specific Boards category; Hi, i'm learning to program in c++ for windows. Is it possible someone could make an example of a window ...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    10

    I'm learning C++, but need an example..

    Hi, i'm learning to program in c++ for windows. Is it possible someone could make an example of a window with just a button on it? I learn best by just looking at the code and playing around with it... Thanks alot!

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,451
    I don't suppose it crossed your mind that there may be, ohhh, hundreds of examples of small programs on the windows board?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    Unhappy There are no simple Windows programs...

    There are some tutorials atwinprog.org.

    You can make a message box with one function, but making a program that actually runs in a window is a bit more complicated, and you'll probably need a book. Almost every Windows programmer has a copy of Programming Windows, by Charles Petzold. Beware - I was shocked when I first opened Petzold's book and saw his first "Hello Windows" example. It's almost 2 pages long, and all but 2 or 3 lines are "special" functions, structures, and constants that are defined in <windows.h>. There are thousands of functions, structures, and constants in <windows.h>, and you need a book to explain them.

    [EDIT]-
    If you're just learning C++, you should learn standard* text-based C++ before attempting to learn true Windows/GUI programming. On a Windows system, these text-based programs are called Windows console applications These programs run in a DOS-like Window.

    *The C++ language standard doesn't include graphics, mouse input, color, or sound. All of these are system/compiler specific features.
    Last edited by DougDbug; 03-15-2004 at 06:24 PM.

  4. #4
    Registered User
    Join Date
    Mar 2004
    Posts
    10
    Ok! I finally got a button to work!! but it takes up the whole form... can someone fix that and show me what i did wrong? Thanks alot!

    --edit--

    lol, oh i know why it took up the whole form hehe..

    -code removed-
    Last edited by akrocks; 03-15-2004 at 07:09 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Machine Learning with Lego Mindstorms
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 01-30-2009, 01:34 PM
  2. Best Approach for Learning
    By UCnLA in forum C Programming
    Replies: 5
    Last Post: 03-21-2008, 02:35 AM
  3. Need Help On a Simple Bank Program
    By oobootsy1 in forum C# Programming
    Replies: 9
    Last Post: 08-08-2005, 10:51 AM
  4. Fun Learning a New Language
    By UnregdRegd in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 09-30-2003, 10:03 PM
  5. Learning Rate Of C++
    By Krak in forum C++ Programming
    Replies: 27
    Last Post: 01-29-2003, 12:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21