so THIS is how Windows programming in C++ goes

This is a discussion on so THIS is how Windows programming in C++ goes within the Windows Programming forums, part of the Platform Specific Boards category; How come Win32 programmers always direct me to tutorials that shows me how to make GUI C++ programs from a ...

  1. #1
    former member Brain Cell's Avatar
    Join Date
    Feb 2004
    Posts
    472

    so THIS is how Windows programming in C++ goes

    How come Win32 programmers always direct me to tutorials that shows me how to make GUI C++ programs from a "scratch" and never told me that i could do it much much easier with VC++6's IDE? It works almost like Visual Basic , you just need to concentrate on the program's code it-self instead of wasting time writing the controls and their coordinates. Check the attachment to see what i'm talking about.


    Back to the question , do Win32 programmers enjoy doing things the hard way? I'VE ALWAYS THOUGHT I SHOULD CODE THE WHOLE INTERFACE BY MYSELF. I even wasted so much time on VB.NET because of this reason


    i'm calm
    Attached Images Attached Images  
    My Tutorials :
    - Bad programming practices in : C
    - C\C++ Tips
    (constrcutive criticism is very welcome)


    - Brain Cell

  2. #2
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,266
    Dialogs have a particular use. They're designed for making prompts, option selection windows and other "little" things where there are a lot of small, simple controls involved.

    You can make all windows in your program using dialogs if you like, but I find that using them for a main window is challenging because amongst other things the default coordinate system associated with a dialog's display context (DC) is a proportion of the system font. This means that if for example I wanted to place a child window at (1, 1) in pixels on the dialog it wouldn't be right. You can change the coord system but I find it a chore.

    When you're dealing with large numbers of simple controls, use a dialog. If you're using your own custom controls/wanted to do spiffy things directly the window, save the hassle and handle it all yourself.

  3. #3
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    holy !@#@!.. this is the first time I've seen this..! I've been writing all the code myself as well...!!!!@#!
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  4. #4
    former member Brain Cell's Avatar
    Join Date
    Feb 2004
    Posts
    472
    SMurf , i don't clearly understand what you mean, i've never dealt with Win32 C++ programs. A friend told me that he's always made his Win32 programs using dialogs with no problems. Can you explain in simple words what's the problem with using dialogs for your whole program?

    Quote Originally Posted by The Brain
    holy !@#@!.. this is the first time I've seen this..! I've been writing all the code myself as well...!!!!@#!
    Are you being sarcastic?
    My Tutorials :
    - Bad programming practices in : C
    - C\C++ Tips
    (constrcutive criticism is very welcome)


    - Brain Cell

  5. #5
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    No!!! I Have Never Seeen This>...!!!! !!!!!!!!!!!!!!!!!!!!!


    so how exactly did you go about accessing this workspace..???



    This is the kind of stuff they don't teach you in the book..!!!


    Can't believe all this time I've been trial and error guessing my x,y coordinates...!
    Last edited by The Brain; 06-27-2005 at 10:42 AM.
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  6. #6
    Registered User
    Join Date
    Mar 2005
    Posts
    76
    This remark is somewhat offtopic, but in general, when you try to do something simple, and it is very hard tou achieve with your selected method/function/class, there is a big chance there is an easier way. I have used this "rule of the humb" many times and it saved me a lot of time . If your uncertain, ask it on a board forum. (obviously AFTER doing a search).

    Often i can replace 10 lines of code with a single one after i find a particular function in msdn of which i didnt know the exisetence.
    Last edited by johny145; 06-27-2005 at 12:19 PM.

  7. #7
    C++ Enthusiast jmd15's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    532
    Oh just a quick reply to what The Brain said about guessing the x and y coordinates. You might have already known this but you don't have to guess them totally. You can use GetSystemMetrics or a similar function to find the screen's size and divide it by whatever, like 2 if you wanted it in the middle of the screen. That way it's portable to other computers. Just a suggestion if you didn't know that already. An example of GetSystemMetrics:
    Code:
    int X=GetSystemMetrics(SM_CXSCREEN);
    int Y=GetSystemMetrics(SM_CYSCREEN);
    You can also use that function to find the dimensions of a few other things, check it out on msdn.com.
    Trinity: "Neo... nobody has ever done this before."
    Neo: "That's why it's going to work."
    c9915ec6c1f3b876ddf38514adbb94f0

  8. #8
    former member Brain Cell's Avatar
    Join Date
    Feb 2004
    Posts
    472
    The Brain , to bring up this dialog workspace (or whatever it's called) ; start a new empty Win32 project in VC++6 , then from the menu go to Insert -> "Resource" then double click "Dialog".


    Still waiting for someone to clear things up about using dialogs
    My Tutorials :
    - Bad programming practices in : C
    - C\C++ Tips
    (constrcutive criticism is very welcome)


    - Brain Cell

  9. #9
    I am he who is the man! Stan100's Avatar
    Join Date
    Sep 2002
    Posts
    361
    TheBrain, you aren't kidding are you?

    Em the only time I ever really use that is if I'm making a dialog box, because M$VC++ is a .......... when it comes to resources

    Other than that only losers use the IDE. Heh, joking of course
    Stan The Man. Beatles fan

    When I was a child,
    I spoke as a child,
    I thought as a child,
    I reasoned as a child.
    When I became a man,
    I put childish ways behind me"
    (the holy bible, Paul, in his first letter to the Cor. 13:11)

  10. #10
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,904
    I find that the visual editor found in visual C++ is a very nice tool for laying out your windows before you create them. I'll admit I myself spent a while just making static dialog prompts without ever really knowing any other way.

    However, there are times when the visual editor is not good enough. For example, if you want to be able to resize your window, you're going to have to handle the WM_SIZE command and manually place all of your controls. However, I've still used the visual editor to place them in the first place as it saves a ton of guess-and-check work that needs to be done for making layouts.

  11. #11
    Registered User
    Join Date
    Jun 2004
    Posts
    722
    any kiddie can make a gui from a gui editor like that. If you want to learn you have to program. Plus those gui editors store everything in resources, when code is preferable.

  12. #12
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    >>do Win32 programmers enjoy doing things the hard way?
    Being a (good?) WIN32 programmer requires a certain level of masochism (enjoyment of pain). Particularly if you don't use a wrapper (like MFC) or a resource editor.

    The real power of WIN32 (over VB) is the diversity you can create. If you learn how to create controls on the fly ect from the start then you have the tools to do any task required.

    Sometimes you need the controls on the main window (or in MDI children or the toolbar).
    In these cases you can not use the resource editor and need to know how to create, resize and remove your controls.

    Depends on the app. I use both.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  13. #13
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    Quote Originally Posted by novacain
    Being a (good?) WIN32 programmer requires a certain level of masochism
    Can you say understatement?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows 98/2000 programming in Windows XP
    By Bill83 in forum Windows Programming
    Replies: 3
    Last Post: 07-22-2005, 03:16 PM
  2. Dialog Box Problems
    By Morgul in forum Windows Programming
    Replies: 21
    Last Post: 05-31-2005, 06:48 PM
  3. dual boot Win XP, win 2000
    By Micko in forum Tech Board
    Replies: 6
    Last Post: 05-30-2005, 03:55 PM
  4. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 01:19 AM
  5. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 06:31 PM

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