Thread: Windows GUI

  1. #31
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    Quote Originally Posted by nutzu2010 View Post
    yes,is a good idea, but I do not know many things in C++(Object-oriented programming,Classes,and many things)
    If you aren't very comfortable with C++ then GUI programming in C++ probably isn't the best way to learn it since you would have a double challenge, learn both a new API and wrestle with learning the language aswell. Not saying it isn't possible but the challenge will be bigger. You can always look at some of the tutorials and see if you understand what is going on but always expect anything you want to do on your own as being harder than what tutorials show you. Really the best advice I can give.

  2. #32
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by nutzu2010 View Post
    yes,is a good idea, but I do not know many things in C++(Object-oriented programming,Classes,and many things)

    LE.:Thanks for all your help,and thank you @CommonTater,because you have fought with all.
    As I said, I'm going to sit at C.I have a lot to learn in C and more to be switched to C++
    Think of it as a progression...
    1) Get comfortable with C as you say.
    2) Do some WinApi in C, at least enough to get the basic concepts.
    3) Get comfortable in C++ at console and WinApi
    4) Now you can explore other libraries, etc.

    This way you are continuously adding to your knowledge with no big leaps into unfamiliar territory...

    C is good basic programming skill. WinApi gets you working GUI code, windows messages and a bunch of other really interesting stuff... C++ is adding to your C skills and WinApi is the same at C or C++ levels... other libraries (or environments) are now mostly an adjustment from the skills you already know.

    The reason I wrankle at people who spit on WinAPI (or such) is that they are literally suggesting you ignore a worthwhile skillset... and that's just wrong.

  3. #33
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by CommonTater View Post
    Okey Dokey...

    The attitude here is the same as it would be if I was talking to a friend in a coffee shop and whatshisknob just walked over, out of a clear blue sky, and started telling me how wrong I was about everything.
    What about YOUR attitude, then?

    First of all Windows API introduces no extra bloat... it's still there whether you use it or not. It's a native part of the windows distribution... You've already paid for it.

    Second, those widget libraries like QT actually call Windows API functions... how else do you think they create a window or draw a menu? There's no magic OS bypass, they're just heaping their code on top of what's already there.
    Ah, good analogy.
    Windows API are free. Wait. The API are wrappers around the kernel calls, so why don't we call kernel calls directly? It will cause less overhead.
    But wait, the kernel calls merely wraps different calls to the drivers. So why don't we just create a driver directly? Oh wait, the drivers have overhead! They are coded in C(++)! So why don't we write them in assembly? Oh, wait! Assembly has overhead, too! We have to write it in pure binary code, otherwise there will be overhead! Oh wait! There will always be overhead because of the OS and context switching! Why don't we throw the OS out the window and talk directly to the hardware ourselves? That way, there will be no overhead. No price to pay.

    As we've discussed before (and agreed) it is indeed superficially easier and quicker to use these libraries, especially with the boss breathing down your neck... But do they produce better code ... No of course not, how can they when they're directly connected to all the foibles of the Windows API they call...

    What you're doing is essentially creating a remote operating station for your Honda so that you can sit in your Jaguar... either way you still get there in the same amount of time ... but the Honda will cost you less and cause you a lot less trouble so you might as well just drive the Honda.
    Oh, nice analogy! Very.
    How about this: you can either steer your car through the wheel and pedestals, or you can try to turn every wheel manually and feed gas into your engine manually. Hey, I mean it works. And it's easy. So easy. I mean, it has to be just as easy and quick as using a wheel and pedestals!

    Best I can tell there are two primary reasons people reject working directly in OS APIs... 1) they don't understand it and 2) they can't be bothered to learn it...
    Or how about the fact that you so conveniently fail to understand? It's faster, it's more productive, it's less work, it's less buggy.
    That is a fact. Take an experienced WinAPI programmer. Take an experienced framework of your choice programmer. Set them on creating an application. Which one will finish first? And which one will be least buggy?
    That is the ultimate test. If you guess correctly, you pass. If not, you fail.

    My suggestion to the OP was that he continue his learning experience in C with the native API he already has available to him... Had our buddy not jumped on it like a ton of bricks you would have seen me recommend that once he got confident with that he should look to C++ and perhaps some of the third party libraries...

    That rather than running scared and never learning it at all.
    No. What was suggested was that IF the OP went the C++ way, Qt would be a good choice.
    If the OP sticks to C, which is perfectly fine, then using another framework, such as GTK, et all, is a good idea instead of the Win API.

    Neither you nor Shackti acted out of concern for the OP... you both jumped right in swinging your hatred of Windows API around...
    And for good reason.

    Quote Originally Posted by nutzu2010 View Post
    yes,is a good idea, but I do not know many things in C++(Object-oriented programming,Classes,and many things)

    LE.:Thanks for all your help,and thank you @CommonTater,because you have fought with all.
    As I said, I'm going to sit at C.I have a lot to learn in C and more to be switched to C++
    Using C is fine. Using Win API is bad. I strongly recommend a framework, such as GTK, among other things, instead.

    Quote Originally Posted by CommonTater View Post
    Think of it as a progression...
    1) Get comfortable with C as you say.
    2) Do some WinApi in C, at least enough to get the basic concepts.
    3) Get comfortable in C++ at console and WinApi
    4) Now you can explore other libraries, etc.
    Absolute nonsense.
    Getting comfortable with C/C++ is a start, yes, but the rest is rubbish.
    Learning the Win API is a big waste of time. Specialize in learning frameworks instead. They will 99% of the fill your requirements. And then you will have gained absolutely nothing from learning the WinAPI except for wasting a lot of time.

    This way you are continuously adding to your knowledge with no big leaps into unfamiliar territory...
    Furthermore, learning C++ does not add to your C skills. They are separate worlds, and rightly should be so.

    C is good basic programming skill. WinApi gets you working GUI code, windows messages and a bunch of other really interesting stuff... C++ is adding to your C skills and WinApi is the same at C or C++ levels... other libraries (or environments) are now mostly an adjustment from the skills you already know.
    C is not necessarily good basic programming skill. That is your subjective opinion.
    WinAPI gets you started writing buggy GUI code in a lot of time, compared to say, a framework, that will let you create a GUI in working condition, with small amount of bugs, in a short time.
    Except WinAPI is a hindrance to C++. It is limiting the language's abilities and tools, which is never a good thing.

    The reason I wrankle at people who spit on WinAPI (or such) is that they are literally suggesting you ignore a worthwhile skillset... and that's just wrong.
    The reason I spit at people suggesting learning WinApi is because it's a waste of time and doesn't make you a better programmer. It encourages you to write a lot of unportable, buggy code. And THAT is just wrong!
    Last edited by Elysia; 04-05-2011 at 02:52 AM.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #34
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Learning the Win API is a big waste of time. Specialize in learning frameworks instead. They will 99% of the fill your requirements. And then you will have gained absolutely nothing from learning the WinAPI except for wasting a lot of time.
    Here your prejudices are showing very clearly.

    And yes, Elysia... it is a prejudice.

    I have agreed with you several times that high level frameworks do have their place in programming... in fact, I even agree that in some cases they can and do compete nicely with raw WinAPI code...

    Where we fall off the log is when you start insisting that people should NOT learn something because YOU hate it. Not only is this terrible advice, it's totally selfish advice! You are literally asking the OP to skip a major skillset just to please you... What a horrible demand to make of anyone, moreso of someone just starting out!

    The reason I spit at people suggesting learning WinApi is because it's a waste of time and doesn't make you a better programmer. It encourages you to write a lot of unportable, buggy code. And THAT is just wrong!
    There it is again.... Same prejudice.... Same demand...
    Last edited by CommonTater; 04-05-2011 at 08:56 AM.

  5. #35
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    Quote Originally Posted by CommonTater View Post
    I have agreed with you several times that high level frameworks do have their place in programming... in fact, I even agree that in some cases they can and do compete nicely with raw WinAPI code...

    Where we fall off the log is when you start insisting that people should NOT learn something because YOU hate it. Not only is this terrible advice, it's totally selfish advice! You are literally asking the OP to skip a major skillset just to please you... What a horrible demand to make of anyone, moreso of someone just starting out!
    Just like you insist on people learning it because you like it. It is an equally selfish advice and you are just as guilty as me and Elysia in that regard. I did not ask the OP to do anything. I did not tell him to skip anything. If you look at my first post in this thread you will see that I merely pointed out that IF he decided to go the c++ route, he should at least take a look at Qt. You on the other hand just told him to go with WinAPI without presenting any options whatsoever. Equally guilty of you pushing an agenda.

    There it is again.... Same prejudice.... Same demand...
    Same can be said in the other direction you know. What says Qt or GTK or whatever isn't an at least equally worthwhile skillset as WinAPI? What makes WinAPI so special it should come before any other API?
    Last edited by Shakti; 04-05-2011 at 09:17 AM. Reason: Grammar errors

  6. #36
    Registered User
    Join Date
    Dec 2010
    Posts
    71
    I don't know what to think...I understand why they are good(Qt,GTK because they are cross-platform)...and WinApi uses less memory...
    but many companies do multiple versions (for linux,windows,mac,etc...)
    Why not make a single version?(with Qt or GTK)

  7. #37
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    What do you mean make a single version? If you mean why not standardize the API accross platforms so you can use the same lowlevel API on all platforms it is because it is pretty much impossible. All current applications uses WinAPI at some level, so to switch that out would mean to break pretty much every application in existance for windows, or do some horrible dual-mode thing. Same is also true for linux/mac.

    Not even on linux which GTK, Qt and so on are mostly associated with are they lowest level before you hit driver/kernel calls. You have X11 windowing system which has its own API that is then used by GTK/Qt/Whatever.

    The windowing systems also have completely different origins. For example X11 uses a client-server architecture that stems from the fact that historically you would connect to a terminal server to gain access to a graphical interface, completely different than windows.

    Nowadays alot of graphical programming on windows shifts towards using C# which is a higher-level language with very nice graphics programming support.

    Edit:
    Ok I reread the post and am I right in thinking you meant that alot of companies do multiple versions of their application, for linux, windows and so on? And why they aren't using things like Qt or GTK? Well, the reasons can be many in those cases. Maybe they started with only windows in mind and then after pretty much being done with windows did they think of releasing on other platforms. Or their lawyers might not like something that is in the licenses of the different libraries (GPL licensed library creates a license lock-in for the application itself, note do not confuse with LGPL though). However I think you will be hard-pressed to find an application that was designed with cross-platform in mind and a priority that doesn't use multiplatform libraries.
    Last edited by Shakti; 04-05-2011 at 10:00 AM.

  8. #38
    Registered User
    Join Date
    Dec 2010
    Posts
    71
    Ok I reread the post and am I right in thinking you meant that alot of companies do multiple versions of their application, for linux, windows and so on? And why they aren't using things like Qt or GTK?
    yes, that's what I said

    then,why use the term cross platform?(beginner question)

  9. #39
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by nutzu2010 View Post
    I don't know what to think...I understand why they are good(Qt,GTK because they are cross-platform)...and WinApi uses less memory...
    but many companies do multiple versions (for linux,windows,mac,etc...)
    Why not make a single version?(with Qt or GTK)
    Ok... I'm not saying these QT/GTK etc. libraries are bad... never have never will.

    What I'm saying is that you can take a progression in learning that will ultimately land you in a very good place as far as programming skill goes if you don't avoid knowledge.

    So many people run screaming into the night over the notion of working in WinAPI (or it's equivalents on Linux or Mac) that people who actually know and can work with this code are becoming something of a valued commodity...

    Keep in mind that not all programming happens in 3rd party developer's shops. There are still a lot of in-house programmers and very often they work only on a single platform (most often, Windows) for their entire stay. For these guys and gals, "crossplatform", "multitarget" etc. is totally meaningless.

    Even in companies that produce for multiple platforms, the specialization of WinAPI (...) is valuable in debugging the actual cross-platform libraries they use.

    I have an acquaintance who, like me worked mostly at WinAPI. To get his current job he had to learn a couple of different widgets libraries. After about a month at work there was a problem in one of the libraries and everyone was running around "Anyone know WinAPI?"... he fixed the bug and got promoted beyond probation in the process.

    So it's not the dreaded waste of time it's made out to be.

    As it is said: "We avoid knowledge at our own peril".

  10. #40
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    then,why use the term cross platform?(beginner question)
    Because when you use a library like Qt or GTK they have implementations on more than one platform. You can take code that uses purely standard C/C++ together with GTK/Qt or any other crossplatform library, and compile it on windows and have a working application, compile it on linux and have the same functionality on linux.

  11. #41
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by nutzu2010 View Post
    yes, that's what I said

    then,why use the term cross platform?(beginner question)
    Because a program compiled for windows will not run natively on Linux or Mac. (They can be run with emulators, but they are not compatible otherwise). This means that in order to release a program for Win, Lin and Mac... you actually have to compile the code 3 times.

    Where these "cross-platform" libraries come in is providing the same application programmer interface (API) for all three platforms. It's actually 3 sets of libraries, but they are structured to look alike to the programmer. Thus one source code can be used on all three platforms.

  12. #42
    Registered User
    Join Date
    Dec 2010
    Posts
    71
    I thought that only works with an " .exe" on more systems
    now I know what it means "cross platform" ,really
    you need to have a virtual machine for compile the code,right?
    and then ,Why take up more space the Qt?

  13. #43
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by nutzu2010 View Post
    you need to have a virtual machine for compile the code,right?
    Actually no... cross platform compilers can emit a windows program on a machine running linux... it just won't run natively on Linux so you need the means to test it. This can be either an emulator, a virtual machine or a separate computer... just so it's running Windows.

    Anyhow... this is getting far afield from your intial inquiry about setting up windows GUI for a game.
    If you don't feel that inquiry has been adequately answered, just say so and we can confine ourselves to that from here...

    (The really ironic part of all this is that I suggested the thread be split off of another thread that we were hijacking... and it almost immediately got hijacked! )
    Last edited by CommonTater; 04-05-2011 at 10:48 AM.

  14. #44
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by CommonTater View Post
    Here your prejudices are showing very clearly.

    And yes, Elysia... it is a prejudice.
    Oh! I am guilty of prejudice? Then what are you?
    I have mixed facts with opinions, but you have thus far spouted only opinions (such as denouncing libraries in all possible ways).

    I have agreed with you several times that high level frameworks do have their place in programming... in fact, I even agree that in some cases they can and do compete nicely with raw WinAPI code...
    That is not what you have claimed in this topic. You started all of this, you know.

    Where we fall off the log is when you start insisting that people should NOT learn something because YOU hate it. Not only is this terrible advice, it's totally selfish advice! You are literally asking the OP to skip a major skillset just to please you... What a horrible demand to make of anyone, moreso of someone just starting out!
    Me not liking WinApi is one thing. But the relevance of it is another thing.
    I have stated it not only because I don't like it, but because there is usually no point to learning it. Why? Because, once again, there are better tools out there that does the work for you. Simple advice.
    And aren't YOU pushing people to learn the WinApi because YOU like it?

    In the end, the programmer who gets things done usually wins.
    And if a programmer ends up with a working program in a month that is bug free while you sit there tearing your hair out with WinApi with only a half-finished product, you lose.

    Quote Originally Posted by nutzu2010 View Post
    I thought that only works with an " .exe" on more systems
    now I know what it means "cross platform" ,really
    you need to have a virtual machine for compile the code,right?
    and then ,Why take up more space the Qt?
    Cross platform means that you can take the same code and compile it on different platforms without changing it.
    Code in WinApi and you have to rewrite it to compile it on Linux and Mac, for example. Use GTK, Qt, etc, and you can compile it directly on Windows, Linux and Mac without any modifications.
    That is the purpose of multi-platform and partly why they're so good.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  15. #45
    Registered User
    Join Date
    Dec 2010
    Posts
    71
    I do not have questions.
    I still have time to think to a library for GUI.

    Quote Originally Posted by Elysia
    Cross platform means that you can take the same code and compile it on different platforms without changing it.
    Code in WinApi and you have to rewrite it to compile it on Linux and Mac, for example. Use GTK, Qt, etc, and you can compile it directly on Windows, Linux and Mac without any modifications.
    That is the purpose of multi-platform and partly why they're so good.
    Yes, it's good.i'll take into account
    Last edited by nutzu2010; 04-05-2011 at 11:05 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Making a windows GUI app
    By Pota in forum C++ Programming
    Replies: 7
    Last Post: 03-09-2011, 05:29 PM
  2. C++ gui for windows where to start
    By prixone in forum Windows Programming
    Replies: 2
    Last Post: 12-16-2006, 11:48 PM
  3. Windows GUI Preprocessing
    By Jaken Veina in forum Windows Programming
    Replies: 5
    Last Post: 07-22-2005, 01:22 PM
  4. Linux's GUI slower than windows'....
    By Nutshell in forum A Brief History of Cprogramming.com
    Replies: 34
    Last Post: 02-16-2002, 08:47 PM
  5. GUI Programming :: C++ Exclusive
    By kuphryn in forum C++ Programming
    Replies: 5
    Last Post: 01-25-2002, 03:22 PM