From: Richard Heathfield on
[Cross-posted to comp.os.ms-windows.programmer.win32 and Followup-To set to
that group.]

Jrdman said:

> what's the minimum code should i add to this code:
> #include<windows.h>
> int APIENTRY WinMain(HINSTANCE hinstane,
> HINSTANCE hpinstance,
> LPSTR lpcmdline,
> int cmdshow){
>
> while(1)
> ;
>
>
> }
>
> to get a window not a console?

#include <comp.os.ms-windows.programmer.win32>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
From: Sten Westerback (MVP SDK 2005-6 :) on

"Richard Heathfield" <rjh(a)see.sig.invalid> wrote in message
news:ce-dnf0PkJQkffHVRVnyhgA(a)bt.com...
> [Cross-posted to comp.os.ms-windows.programmer.win32 and Followup-To set
> to
> that group.]
>
> Jrdman said:
>
>> what's the minimum code should i add to this code:
>> #include<windows.h>
>> int APIENTRY WinMain(HINSTANCE hinstane,
>> HINSTANCE hpinstance,
>> LPSTR lpcmdline,
>> int cmdshow){
>>
>> while(1)
>> ;
>>
>>
>> }
>>
>> to get a window not a console?

Firstly you shouldn't use 100% of the CPU all the time.
Secondly you need a Message loop (check GetMessage())
Third you need Window creation code.. RegisterClass() and CreateWindow.
Fourth you need a WndProc function that implement your window rendering and
other activities.

Or you could make it easier by implementing it as a Dialog.. DialogBox() and
DlgProc.

Or you could use MFC or .NET as an alternative.. or VB...

If you still feel lost.. get or borrow a book such as "Programming Windows
....." by Charles Pezold & co. Or ask more specific questions with your
non-working code snipets here.

- Sten