| newbieg (173) | |||
|
Hi, this is my first attempt at opening a window using Windows API, I copied it out of my book, but it's hand typed, so there's probably something I missed and I just can't find it. My problem is that the window isn't being opened/painted on my screen, but my debugger keeps running like it's caught in a loop (the loop part is what this should do until the exit button is pressed). Can someone please take a look at this and tell me where I went wrong?
I tried placing cout<<"got this far"; on the first line under my winmain() but no console opened, does this mean that the program didn't even open winmain? | |||
|
Last edited on
|
|||
| modoran (1245) | |||
Windows GUI applications does not work that way. To get a console you need to use AllocConsole() first and only then you can use iostreams:
Before exiting don't forget to call FreeConsole() API. | |||
|
|
|||
| newbieg (173) | |
| Thanks Modoran, I'll have to remember that. | |
|
|
|
| newbieg (173) | |
|
I just want to post this link here in case anyone reads this post and wants an example for a working WINAPI program with "Hello world" as a starting template. The tutorial supplied there was just a bit confusing and didn't explain things well, but the final example does work correctly with visual C++ 2012. http://msdn.microsoft.com/en-us/library/vstudio/bb384843%28v=vs.100%29 Using that and my book Horton's "Beginning Visual C++ 2010" at the same time helped out. | |
|
Last edited on
|
|