Windows and C++

This is a discussion on Windows and C++ within the C++ Programming forums, part of the General Programming Boards category; Do you need to know the basics of C++ ie. cout etc. in order to program windows applicatipns?...

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    21

    Windows and C++

    Do you need to know the basics of C++ ie. cout etc. in order to program windows applicatipns?

  2. #2
    Handy Andy andyhunter's Avatar
    Join Date
    Dec 2004
    Posts
    540
    You need to know either C or C++ and be comfortable with the features of the language otherwise you will find learning windows programming very frustrating and most likely not get all of it.
    i don't think most standard compilers support programmers with more than 4 red boxes - Misplaced

    It is my sacred duity to stand in the path of the flood of ignorance and blatant stupidity... - quzah

    Such pointless tricks ceased to be interesting or useful when we came down from the trees and started using higher level languages. - Salem

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    70
    I've learned the basics of C and the windows API, but I'd like to manipulate controls through ctl.Width, ctl.Height, etc... Since C++ is so legendary object oriented, would it be possible to "wrap up" the APIs I use into classes, and then make the class call the appropriate API to actually enforce the values (when a member such as .WIDTH has been changed)?

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    It's kind of possible. You can't "monitor" variables, but you can use getter and setter methods instead.

    MFC is one such library, wxWindows, GTKmm, ...
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Registered User
    Join Date
    Jan 2005
    Posts
    70
    So, the MFC (or compareable lib) adds code to compare members to theri previous values to see a change? Is there no way to make the compiler translate the instruction button.Height = xx to the appropriate API, so you don't need a bunch of IFs? Such a compiler could be visual basic ofcourse, but it's nutoriously slow and since I want to learn to make my own controls and classes, I thought I should go for the 'truly object oriented' C++

  6. #6
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    No, MFC doesn't do that. MFC hides its variables and provides setter and getter functions. That's the only proper way to go about it in C++.

    You might want to look at C#, though.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  7. #7
    Registered User
    Join Date
    Jan 2005
    Posts
    70
    MFC hides its variables and provides setter and getter functions
    Could you elaborate a little?

  8. #8
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    You don't do
    win.Height = 200;
    in MFC. You do
    win.MoveWindow(x, y, width, height);
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  9. #9
    Registered User
    Join Date
    Jan 2005
    Posts
    70
    I see. You don't happend to know if there's a compiler other than VB that works the way I want? What about Ruby?

    I'm thinking you could associate Getter and Setter functions with the members of a class, and if a series of instructions involving the same API appear without following code that depends on it already beeing enforced, the compiler could collect them into as few API calls as possible, for example passing the RECT structure one time after seeing .Width, .Height, .Left, .Top changes... For simple things like this example you may wonder what's wrong with using either MFC-functions or the API calls directly, but I just think it would be more object oriented from a human point of view if things could work the way I described.

    You see why I dream of making my own compiler?

  10. #10
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    Quote Originally Posted by Me
    You might want to look at C#, though.
    However, I'm not aware of any compiler that can "collect" calls. That would be something extremely difficult to do, given the nature of polymorphism.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  11. #11
    Registered User
    Join Date
    Jan 2005
    Posts
    70
    They say "you can't always get what you want" (and yes, I'm also a Rolling Stones fan), but you have to agree I have a nice vision? Just tell me I'm not the only one, and if you know, point me to some resources...

  12. #12
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    I'm sure you're not the only one who dreams of things that are practically impossible to do.

    What kind of resources? There's a C# board here.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  13. #13
    Registered User
    Join Date
    Jan 2005
    Posts
    70
    What kind of resources?
    Either about existing compilers somewhat like I described, or about making compilers...

  14. #14
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    Don't have anything about either, sorry. Compilers that support properties are, for example the C# compiler.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  15. #15
    Registered User
    Join Date
    Jan 2005
    Posts
    70
    Anyone knows if MFC or C#-style properties can be used in development for handheld (microsoft) devices?

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

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