Cam
Administrator
[M:5000]
Posts: 6,381
|
Post by Cam on Dec 26, 2010 23:06:28 GMT
I want to put my C++ calculator into a window, can some one show me the C++ code for a window and how to put my code into it?
Thanks.
|
|
xcessive
Epic Poster
.[M:5000]
Posts: 526
|
Post by xcessive on Dec 27, 2010 0:40:20 GMT
|
|
Jordan
Elite Poster
[M:5000]
Posts: 286
|
Post by Jordan on Dec 27, 2010 1:31:50 GMT
doc.trolltech.com/4.1/widgets-calculator.htmlYou are really going to want to use a framework such as Qt (Skype uses this) or wxWidgets (Codeblocks uses this). Using the win32 API is a waste of time because you have to write a lot of code and it only works for windows. If you ever wanted to port your program to another operating system which is having to be done all the time then you'd have to re-write the GUI portion from scratch using that operating system's API. Plus, the guys who write code for C++ GUI frameworks can do a better job than you or I could. They have everything wrapped and organized into classes which make them easy to use because GUI's are a serious pain the in the ass to make from scratch. Trust me, I started one with SDL. You should be spending your time developing the backend of your product and not the frontend. Those frameworks aren't hard to use either, just download them and do a quick tutorial. I could make a calculator with Qt in just a few minutes. I'm still out of town, but when I get back I'll be able to show you how to do it the right way. If you ever develop a product for a customer you do not want to be using the win32 API directly unless what you need isn't already coded.
|
|
prads
Elite Poster
[M:0]
It's a shame that PI isn't an integer :(
Posts: 361
|
Post by prads on Dec 27, 2010 9:26:20 GMT
^Learning Win32 API isn't waste of time. lol And yeah API are more difficult than wrappers and stuffs but it does give you knowledge of inner working of Windows and knowledge is never useless. I suggest you do it with win32 API first, that way you will know about how windows messages are sent and how windows handles those messages, and then later learn to use frameworks and stuffs.
And by the way, this was what I was thinking or writing an article on, building a Windows GUI for cC magazine. lol
|
|
Jordan
Elite Poster
[M:5000]
Posts: 286
|
Post by Jordan on Dec 27, 2010 18:25:25 GMT
Yes, knowing the win32 API will help you understand the inner workings of windows, but I really think a developers time should be spent on something else unless the thing they are working on is a GUI framework. I see it as a waste of time since you are writing a lot more code for much less portability and compatibility.
If you are just learning then it wouldn't hurt to write and application or two with win32, but for any serious project I highly recommend using a well developed framework so most of your time can be spent on the backend of the project.
A tutorial using the win32 API would be great for this forum so you should write one.
|
|
xcessive
Epic Poster
.[M:5000]
Posts: 526
|
Post by xcessive on Jan 2, 2011 2:05:33 GMT
This is why I have grown to dislike C++ for anything requiring a complex front end.
|
|
Jordan
Elite Poster
[M:5000]
Posts: 286
|
Post by Jordan on Jan 2, 2011 19:08:12 GMT
This is why I have grown to dislike C++ for anything requiring a complex front end. Yeah, it's definitely not the best language to use for the front end of a program. There's just too much coding involved.
|
|