Jump to content

  • Log In with Google      Sign In   
  • Create Account


Basic Win32 window with C++


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Inuyashakagome16   Members   -  Reputation: 835

Like
0Likes
Like

Posted 02 February 2013 - 07:03 AM

Recently I've been working on just creating a basic window with the Windows Api and I'm finding it very difficult  Not too understand, but to expand my window and add separators for certain and just adding buttons in general can be a bit of a pain. 

Is there an easier way/Is there a different library I should try using?

 

I'm using Visual Studio 2010 Ultimate with C++ (and DirectX11)

 

(Also I'm aware the rc file can be edited in ResEdit (which acted strange for me) and inside of Visual Studio)



Sponsor:

#2 GameCodingNinja   Members   -  Reputation: 162

Like
-2Likes
Like

Posted 02 February 2013 - 08:10 AM

Since your writing a Windows API app in c++, it's all you at that point. If you want easy interface construction, try C#.

 

A simpler way to add controls to a window api c++ app is to use an *.rc file to setup a dialog window as your parent window. Now you can use the MSVS gui to design your window with the needed controls.

 

This example might help you.

http://www.codeproject.com/Articles/227831/A-dialog-based-Win32-C-program



#3 Agbahlok   Members   -  Reputation: 262

Like
1Likes
Like

Posted 02 February 2013 - 08:46 AM

There are bunch of libraries you could use. I think that it's possible to plug Qt into Visual Studio as well as there is wxWidgets that's really easy and powerful ( just a bit tricky to make it work with VS2010 ). Well, as you have Ultimate Edition I suppose you could try MFC as well, but personally I don't like it at all.

If you don't mind using CLR ( which is quite cool in some ways like garbage collection ) I suppose you could try the Windows Forms. 

 

One feature that connects them all is that they are all way easier to understand as well as code is far more programmer-friendly and unlike Windows API in most cases documentation is really clear.

 

I suppose you could make yourself familiar with this post as well http://stackoverflow.com/questions/115045/good-c-gui-library-for-windows



#4 Inuyashakagome16   Members   -  Reputation: 835

Like
0Likes
Like

Posted 02 February 2013 - 09:21 AM

Since your writing a Windows API app in c++, it's all you at that point. If you want easy interface construction, try C#.

 

A simpler way to add controls to a window api c++ app is to use an *.rc file to setup a dialog window as your parent window. Now you can use the MSVS gui to design your window with the needed controls.

 

This example might help you.

http://www.codeproject.com/Articles/227831/A-dialog-based-Win32-C-program

Okay. I've been trying to use the MSVS gui to make the window, I'm just trying to see if there is a better way.

 

 

There are bunch of libraries you could use. I think that it's possible to plug Qt into Visual Studio as well as there is wxWidgets that's really easy and powerful ( just a bit tricky to make it work with VS2010 ). Well, as you have Ultimate Edition I suppose you could try MFC as well, but personally I don't like it at all.

If you don't mind using CLR ( which is quite cool in some ways like garbage collection ) I suppose you could try the Windows Forms. 

 

One feature that connects them all is that they are all way easier to understand as well as code is far more programmer-friendly and unlike Windows API in most cases documentation is really clear.

 

I suppose you could make yourself familiar with this post as well http://stackoverflow.com/questions/115045/good-c-gui-library-for-windows

Alright I'll read through that and see what I can find. More or less what I'm trying to do is setup an editor because I have a decent base of code for DirectX so I was going to try and implement that into the editor. All I've tried doing is using the .rc editor that's in MSVS 2010 Ultimate to make the window and that's working okay. I mean it's not like the GUI creator that's there when you create a VB.Net application but it's decent. I'm just looking for options like separators, picture type boxes, etc etc.



#5 dilyan_rusev   Members   -  Reputation: 870

Like
0Likes
Like

Posted 02 February 2013 - 11:44 AM

If you are working on an editor, I recommend that you use C# and WPF (or WinForms for a bit more straight-forward integration). It is easier, faster to develop, the tools are much better, and integrating C++ and .NET is relatively easy (if all you have to do is read/write files + some sort of in-game viewer).



#6 Amr0   Members   -  Reputation: 1034

Like
4Likes
Like

Posted 02 February 2013 - 12:09 PM

The win32 API does not provide a native interface for separators, and by separators I think you mean the bars between adjacent child windows which the user could drag to resize those windows. While these are not very difficult to create "by hand", a not-so-complex editor can be made without those.

 

I'm one of the few that actually don't hate the win32 GUI API. It's object-oriented, light-weight (compared to the alternatives), it's native, and it has a rich set of controls. On the other hand, it's a C API, it's not easy to get into for lack of comprehensive introductory documentation, MS did not include a designer with the free versions of VS, and it's not so popular these days. But it's a very powerful library once you get your head around how it works and how to write your own custom controls, and most importantly, it's native, so you wouldn't have to deal with all that interop bulls**t to have the editor work with your native graphics engine, and you wouldn't have to learn C#/VB if you don't already know them.

 

Anyway, whether you end up using it or something else is up to you, and I wouldn't blame you for turning to another library, but maybe what you're aiming to accomplish isn't really that difficult to make in win32. From your description, a thin wrapper library like win32++ sounds like a perfect fit for your needs. It has lots of samples to start from.



#7 Inuyashakagome16   Members   -  Reputation: 835

Like
0Likes
Like

Posted 02 February 2013 - 03:07 PM

If you are working on an editor, I recommend that you use C# and WPF (or WinForms for a bit more straight-forward integration). It is easier, faster to develop, the tools are much better, and integrating C++ and .NET is relatively easy (if all you have to do is read/write files + some sort of in-game viewer).

That's pretty much all I'll be doing. A way to display what I've done so far, and the objects I'm trying to get into the game itself. So it would just be using the engine I'm currently making. Which is written in C++. So after long as I can connect C#/WPF with it, then It'll work.

 

 

The win32 API does not provide a native interface for separators, and by separators I think you mean the bars between adjacent child windows which the user could drag to resize those windows. While these are not very difficult to create "by hand", a not-so-complex editor can be made without those.

 

I'm one of the few that actually don't hate the win32 GUI API. It's object-oriented, light-weight (compared to the alternatives), it's native, and it has a rich set of controls. On the other hand, it's a C API, it's not easy to get into for lack of comprehensive introductory documentation, MS did not include a designer with the free versions of VS, and it's not so popular these days. But it's a very powerful library once you get your head around how it works and how to write your own custom controls, and most importantly, it's native, so you wouldn't have to deal with all that interop bulls**t to have the editor work with your native graphics engine, and you wouldn't have to learn C#/VB if you don't already know them.

 

Anyway, whether you end up using it or something else is up to you, and I wouldn't blame you for turning to another library, but maybe what you're aiming to accomplish isn't really that difficult to make in win32. From your description, a thin wrapper library like win32++ sounds like a perfect fit for your needs. It has lots of samples to start from.

I may try that out and see how well it works. Even without separators it would be fine,  I was just looking for a solution / way to set it up. Even if i just had two windows instead of one. (Sort of like a GIMP setup)






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS