Modern GUIS and C++
-
We - a friend of mine and me - are learning C++ (especially concerning the "Microsoft World"). So we decided to code in C++ and not in C# or managed C++. But how to create (modern) GUIs? Thanks for your counsels...
Christian - cwp42
Your post is too subtle and toned down to be Kyle, so i'll assume you are a newbie. With that said, please go post the question in the correct programming forum. Although i don't even recommend you ask the question at all. Google and search thru CP articles first, then ask a more specific question if you get stuck and Googling for the problem doesn't seem to help. Roswell
"Angelinos -- excuse me. There will be civility today."
Antonio VillaRaigosa
City Mayor, Los Angeles, CA -
We - a friend of mine and me - are learning C++ (especially concerning the "Microsoft World"). So we decided to code in C++ and not in C# or managed C++. But how to create (modern) GUIs? Thanks for your counsels...
Christian - cwp42
cwp42 wrote:
So we decided to code in C++ and not in C# or managed C++.
Why did you decide this again ?
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
We - a friend of mine and me - are learning C++ (especially concerning the "Microsoft World"). So we decided to code in C++ and not in C# or managed C++. But how to create (modern) GUIs? Thanks for your counsels...
Christian - cwp42
cwp42 wrote:
But how to create (modern) GUIs?
It's not easy or if it is, it's really time consuming. You shall learn DC(Device context) and also learn inheritance in c++. If you use MFC, which IMHO is easier than working with win32 at least in designing GUIs, then learn sub classing new classes from CWnd or CButton or whatever base class you need to mimic it's behavior. Then handle it's painting events or functions (like
OnEraseBkgnd
orOnPaint
orOnDraw
) and access to it's DC, select appropriate gdi object for drawing by that DC(e.gDC.SelectObject(&pen);
) and draw on DC calling functions likeRectangle
orDrawText
. Then deselect selected objects, and clean them up. These are GDI, things are a little bit different in GDI+ but the concept is the same.// "Life is very short and is very fragile also." Yanni
while (I'm_alive)
{
cout<<"I love programming.";
} -
We - a friend of mine and me - are learning C++ (especially concerning the "Microsoft World"). So we decided to code in C++ and not in C# or managed C++. But how to create (modern) GUIs? Thanks for your counsels...
Christian - cwp42
You will realize sooner or later that you made an unfortunate decision. If you want modern GUI's .NET is really the path you should follow.
-
Your post is too subtle and toned down to be Kyle, so i'll assume you are a newbie. With that said, please go post the question in the correct programming forum. Although i don't even recommend you ask the question at all. Google and search thru CP articles first, then ask a more specific question if you get stuck and Googling for the problem doesn't seem to help. Roswell
"Angelinos -- excuse me. There will be civility today."
Antonio VillaRaigosa
City Mayor, Los Angeles, CASorry. Your're right: I'm a newbe. What I'm looking for is a general decision: what is the right way, a future-proof way, for me designing GUIs for C++ written software. There are lot of frameworks...some opinions that MFC is getting old...but there are new (commercial) versions of MFC 2007... There are GDI+ wrapper...the WinFX...WPF... I'm interested on how would a C++ guru decide.
cwp42
-
You will realize sooner or later that you made an unfortunate decision. If you want modern GUI's .NET is really the path you should follow.
C# is easy to learn and the Framework provides all its functions very comfortable to me. But there are some counter-arguments: C# is slow (e.g. http://www.csharphelp.com/archives2/archive458.html) like JAVA. Java and C# both compile to an interpreted language - in the past they said, this is one of the negativest features to the Basic language(s). So we came to (unmanaged) C++ - and I don't want to fight an ideologic battle.
cwp42
-
C# is easy to learn and the Framework provides all its functions very comfortable to me. But there are some counter-arguments: C# is slow (e.g. http://www.csharphelp.com/archives2/archive458.html) like JAVA. Java and C# both compile to an interpreted language - in the past they said, this is one of the negativest features to the Basic language(s). So we came to (unmanaged) C++ - and I don't want to fight an ideologic battle.
cwp42
cwp42 wrote:
C# is slow like JAVA.
Slow ? no. slower than C/C++, but you could make very crap C/C++ code which could run mush slower than a well written C#/Java code. all depends if you need real time preformances or not. for most management applications, C#/Java speeds are more than enough.
cwp42 wrote:
Java and C# both compile to an interpreted language
then what ? i can't understand in what this is a negative feature, as it is finally compiled to the target assembly at the first execution...!! it seems that you just looked at the negative parts... and know that i am a C++ addict (that is to say that i don't defend C# as if it was the only language i'd know)
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
C# is easy to learn and the Framework provides all its functions very comfortable to me. But there are some counter-arguments: C# is slow (e.g. http://www.csharphelp.com/archives2/archive458.html) like JAVA. Java and C# both compile to an interpreted language - in the past they said, this is one of the negativest features to the Basic language(s). So we came to (unmanaged) C++ - and I don't want to fight an ideologic battle.
cwp42
cwp42 wrote:
C# is slow
And for 99% of applications you will never notice the difference.
cwp42 wrote:
Java and C# both compile to an interpreted language
And this is bad why? It means (in principle at least) that you never need to recompile your application for different platforms. Seriously, if thats the 2 reasons you've chosen for going with unmanaged code you've made an error in judgement. The number of reasons I could think of for going with C# for your bog-standard GUI application would number in the tens. C+ still has many benefits, sure, but you'll find C# much easier to get to grips with, and much more what you expect GUI-wise out of the box.
-
cwp42 wrote:
C# is slow
And for 99% of applications you will never notice the difference.
cwp42 wrote:
Java and C# both compile to an interpreted language
And this is bad why? It means (in principle at least) that you never need to recompile your application for different platforms. Seriously, if thats the 2 reasons you've chosen for going with unmanaged code you've made an error in judgement. The number of reasons I could think of for going with C# for your bog-standard GUI application would number in the tens. C+ still has many benefits, sure, but you'll find C# much easier to get to grips with, and much more what you expect GUI-wise out of the box.
You are right, C# is dead slow, especially on graphics, about 10 times, it is the software GDI+ rendering. WPF is even slower, can be upto 5 times in comparison to WinForms and you will experience awful start up times and huge RAM consumption. btw, C# is compiled at runtime not interpreted but JIT doesn't help any serious performance you are probably looking for. It is so obvious and you can easily see it with IDEs that drag themselves to oblivion. I'd forget the .NET hopefuls trying to pursuade you, if you are doing any decent app that won't slam your target audience machines, then C++ is the way to go. It is harder but you do it like a man without a helping hand of a Java-like mentality somehow thinking managed is cool. Porting to C# abstraction is easy and you have plenty of articles here that will help you build your own framework (you will need one). I'd use a OpenGL and DirectX layer, just look at what MS did with new Messenger, and of course whenever it makes sense XHTML. Those "errors in judgement" hardly quantify any functional requirements, and if you have one for a fast and well-behaved GUI (imagine 10 .NET apps running at the same time, machine becomes unusable), than C# or any .NET stuff can hardly teach you anything 99% of people chase and end up with what? The same 'technology' bloat, but sure you will be more productive and perhaps .NET technology is good for an initial stage of design. Up to you really, it is easy to port between implementations but lets not kid ourselves, .NET is rendering and working as heavy as Java did back in 1998; and its performance is pathetic in comparison to anything C++ (85% yeah sure, in your dreams pedro).
-
C# is easy to learn and the Framework provides all its functions very comfortable to me. But there are some counter-arguments: C# is slow (e.g. http://www.csharphelp.com/archives2/archive458.html) like JAVA. Java and C# both compile to an interpreted language - in the past they said, this is one of the negativest features to the Basic language(s). So we came to (unmanaged) C++ - and I don't want to fight an ideologic battle.
cwp42
cwp42 wrote:
C# is easy to learn
I don't agree. It's sure much easier than c++, but not more than basic. Even for a programmer with c++ background, it takes a good amount of time to learn. Farther more what you are going to do is Visual c# .net for Windows os, which is different from plain c# and makes it times more difficult because one should also get familiar with thousands of events and their parameters and arguments plus working with controls and other os specific materials.
cwp42 wrote:
the Framework provides all its functions very comfortable to me
Sure.
cwp42 wrote:
C# is slow
Yes.
cwp42 wrote:
this[IL] is one of the negativest features to the Basic language(s)
And the best benefit at the same time. It helps to be platform independent which is critical in special works like parallel programming. It increase performance by a just in time compilation for the particular machine it runs on. It (with a common type system)helps interoperability between different languages which is a benefit in team working, etc.
cwp42 wrote:
we came to (unmanaged) C++
So did I, but not because of IL, or .Net being bad. Because I'm a standalone programmer, my apps don't need to be multi platform, I had to have a lot prerequisites installed, customers needed a lot of memory(RAM) and a descend machine, my apps are not large, I didn't like it nor did my customers, it was slow and I hadn't enough reasons to stop using what I learned during years. I earn money with MFC and my customers don't care what I use if the result is the same.
// "Life is very short and is very fragile also." Yanni
while (I'm_alive)
{
cout<<"I love programming.";
} -
You are right, C# is dead slow, especially on graphics, about 10 times, it is the software GDI+ rendering. WPF is even slower, can be upto 5 times in comparison to WinForms and you will experience awful start up times and huge RAM consumption. btw, C# is compiled at runtime not interpreted but JIT doesn't help any serious performance you are probably looking for. It is so obvious and you can easily see it with IDEs that drag themselves to oblivion. I'd forget the .NET hopefuls trying to pursuade you, if you are doing any decent app that won't slam your target audience machines, then C++ is the way to go. It is harder but you do it like a man without a helping hand of a Java-like mentality somehow thinking managed is cool. Porting to C# abstraction is easy and you have plenty of articles here that will help you build your own framework (you will need one). I'd use a OpenGL and DirectX layer, just look at what MS did with new Messenger, and of course whenever it makes sense XHTML. Those "errors in judgement" hardly quantify any functional requirements, and if you have one for a fast and well-behaved GUI (imagine 10 .NET apps running at the same time, machine becomes unusable), than C# or any .NET stuff can hardly teach you anything 99% of people chase and end up with what? The same 'technology' bloat, but sure you will be more productive and perhaps .NET technology is good for an initial stage of design. Up to you really, it is easy to port between implementations but lets not kid ourselves, .NET is rendering and working as heavy as Java did back in 1998; and its performance is pathetic in comparison to anything C++ (85% yeah sure, in your dreams pedro).
-
C# is easy to learn and the Framework provides all its functions very comfortable to me. But there are some counter-arguments: C# is slow (e.g. http://www.csharphelp.com/archives2/archive458.html) like JAVA. Java and C# both compile to an interpreted language - in the past they said, this is one of the negativest features to the Basic language(s). So we came to (unmanaged) C++ - and I don't want to fight an ideologic battle.
cwp42
cwp42 wrote:
C# is slow
C# is goddamn language. It can't be slow. Compiler can produce slow IL. JIT can produce slow native. .NET Framework can contain slow code. GC implementation (ok, or even concept) can be slow. But, C# itself is NOT slow.
[My Blog]
"Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe -
We - a friend of mine and me - are learning C++ (especially concerning the "Microsoft World"). So we decided to code in C++ and not in C# or managed C++. But how to create (modern) GUIs? Thanks for your counsels...
Christian - cwp42
cwp42 wrote:
But how to create (modern) GUIs?
Pick a good GUI library/framework. These days I usually recommend Qt, although WTL can be an interesting choice if you are very good with C++ and don't mind sticking with VC++ and Windows.
-
We - a friend of mine and me - are learning C++ (especially concerning the "Microsoft World"). So we decided to code in C++ and not in C# or managed C++. But how to create (modern) GUIs? Thanks for your counsels...
Christian - cwp42
If you want the speed of C++ and create modern GUIs, take a look at Delphi from CodeGear. There's a free version around too so you can experiment (google Turbo Delphi Explorer, too lazy too lookup the url myself rightnow)
-
C# is easy to learn and the Framework provides all its functions very comfortable to me. But there are some counter-arguments: C# is slow (e.g. http://www.csharphelp.com/archives2/archive458.html) like JAVA. Java and C# both compile to an interpreted language - in the past they said, this is one of the negativest features to the Basic language(s). So we came to (unmanaged) C++ - and I don't want to fight an ideologic battle.
cwp42
cwp42 wrote:
C# is slow (e.g. http://www.csharphelp.com/archives2/archive458.html) like JAVA.
What IS slow is application development in C++ ...you spend all your time wrestling with the compiler, linker and the libraries. If you need to get applications out fast, .Net is the way to go. With ever-increasing processor speeds, amount of ram, multi-cores, etc., the speed advantage of compiled vs interpreted is getting less and less. .Net is easier and a lot less frustrating to learn and does most of the GUI stuff for you so you can concentrate on your program's logic.
-
cwp42 wrote:
C# is slow
C# is goddamn language. It can't be slow. Compiler can produce slow IL. JIT can produce slow native. .NET Framework can contain slow code. GC implementation (ok, or even concept) can be slow. But, C# itself is NOT slow.
[My Blog]
"Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe -
C# is easy to learn and the Framework provides all its functions very comfortable to me. But there are some counter-arguments: C# is slow (e.g. http://www.csharphelp.com/archives2/archive458.html) like JAVA. Java and C# both compile to an interpreted language - in the past they said, this is one of the negativest features to the Basic language(s). So we came to (unmanaged) C++ - and I don't want to fight an ideologic battle.
cwp42
cwp42 wrote:
C# is slow
Yes, C# is slow, but the question is about GUIs. There is no such thing as a real-time GUI per se. User operations are signficantly slower than any well designed implimentation in C# or Java making interface-majority work fast enough by a significant margin. You don't get into speed differences until you start handling major 3D or mathematical operations. For instance coding a particle system with proper variable G based on altitude above the earth for high altitude motion models combined with atmospheric effects (also variable based on altitude) such as drag, and air resistance. Once you get into the higher math on large numbers of objects the speed loss of C# becomes significant. But under a GUI, I doubt even I could tell the difference and I know what to look for. A GUI is limited by the user and therefore the computer is idling more than 99% of the time waiting for user response. A computer, no matter how you slice it, is still faster than the eye-hand response time. If there is a reason other than a GUI for speed, then fine, there is a large majority who make fun of me for using C++, when I list all the features there is usually a snippy response "well if you are doing that you should expect a slow-down anyhow." or maybe even a slight give-in and an exception made. Still, there is a reason why a new version of C++ is coming, there are is a significant enough market for real-time or extremely fast operation environments where C# is just not good enough. But GUIs are definitely in the C# wins over C++ category.
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
-
dnh wrote:
sometimes almost as slow
Visual Studio isn't slow. How can it be slow? It's only ones and zeros??? :confused:
Gary
ghle wrote:
Visual Studio isn't slow. How can it be slow? It's only ones and zeros???
Almost. VS, as every software, is bunch of electric impulses. It's lighting fast, dude. :rolleyes:
[My Blog]
"Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe -
ghle wrote:
Visual Studio isn't slow. How can it be slow? It's only ones and zeros???
Almost. VS, as every software, is bunch of electric impulses. It's lighting fast, dude. :rolleyes:
[My Blog]
"Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfednh wrote:
every software, is bunch of electric impulses
Not when printed on paper, deposited on a CD, hard/floppy disk, Flash Card, EProm, paper tape or punch cards.! :-O Then it's just bits of carbon dust attracted by previously deposited electrical impulses, or ink, magnetic bits, melted wires or holes. No impulse necessary. Still doesn't run (fast or slow). ;P Actually, isn't it all in our minds and biased by our frame of reference, including the perception of time? :confused:
Gary