Re: Windows Procedural Programming




One minute you are saying that a Windows program does not have a WinMain
instead of a main, and the next you are saying that main is a requirement of
the standard and that it must be used?

You seem to be confused.

For GUI apps, I've always used WinMain.
for CUI app, I've always used main.

Simple as that.

You're not actually trying to be helpful, are you. You're just trying to be
smart. I've had the misfortune of working with people like you in the past.
Sorry.



"Alf P. Steinbach" <alfps@xxxxxxxx> wrote in message
news:42e443a2.420230359@xxxxxxxxxxxxxxxxxxxxxx
> * Joe Butler:
> > * Alf P. Steinbach:
> > > * Joe Butler:
> > > >
> > > > Yes. You can create (complex) windows programs (including DirectX
> > > > applications) using just C.
> > >
> > > Right, although not advisable.
> >
> > A matter of personal taste if you don't have any other restrictions.
There
> > isn't ANYTHING that requires C++ in Windows that I know of. Perhaps you
can
> > correct me on this issue.
>
> No, that's correct as far as it goes: you can do anything in C, or
assembler
> or even machine code if you like.
>
> However, it's much less work in e.g. C++ or D or Delphi.
>
> And not just because of the abstraction facilities but because much of the
> Windows API is _designed_ for use with C++, and most of the rest is OO in
> spirit so that an OO language can suppress much of the inessential detail.

As far as C++ is concerned, this statement is just plain wrong. Given a
blank file, it would take just as much work to get a C Windows program going
as a C++ windows program going. Could you give an example of where the
Windows API was designed for C++?

>
>
> [snip]
> > > > A pure Windows SDK program has the following structure.
> > > >
> > > > WinMain() - instead of main()
> > >
> > > Sorry, that's incorrect.
> > >
> > > First because it's a languagecentric view (C or C++), second because
> > > 'WinMain' is Microsoft-specific language extension, third because even
> > with
> > > Microsoft tools 'WinMain' has a special meaning (setting tool default
> > > options) that's not "Windows SDK program" but "GUI subsystem program",
> > > fourth because there are several such special functions, e.g.
'wWinMain',
> > > and fifth but absolutely not least because _there is no need_ to use
> > > 'WinMain' or the like: you can & should just use standard C/C++
'main'.
> > >
> >
> > Sorry, but that's not going to mean much to a Windows beginner, is it?
>
> It's important to stay within standards wherever practical. I don't know
> whether that's going to mean much to a novice, initially. But it will
mean
> more and more as they get more experienced, and being accustomed to using
> non-standard stuff will then come up the toilets and bite their behinds.
>
>
> > OK, I'm being Developer Studio-centric, I know that main is called
somewhere
> > else,
>
> Sorry, that's incorrect.
>
> With the tools you're using it's the Microsoft runtime library that's
> responsible for calling 'main', 'wMain', 'WinMain' or 'wWinMain', or
> whatever you're using.
>
> If you use 'WinMain' then there's no standard 'main' anywhere.
>
>
> > but as far as I'm concerned, for GUI stuff, my initial entry point is
> > WinMain (I'd like to know where the advice says that one SHOULD use main
for
> > a GUI program).
>
> The C and C++ standards, and it's not "advice", it's a _requirement_.
>
> --
> A: Because it messes up the order in which people normally read text.
> Q: Why is it such a bad thing?
> A: Top-posting.
> Q: What is the most annoying thing on usenet and in e-mail?


.



Relevant Pages

  • Re: Windows Procedural Programming
    ... > One minute you are saying that a Windows program does not have a WinMain ... In Windows you can use either WinMain or main as the entry point. ...
    (comp.programming)
  • Re: Converting VOB to AVI
    ... Nice GUI. ... Now if I only had a DVD (VOB) file I could try this out... ... So you advice somebody to use a Windows program, because it looks nice, ...
    (alt.os.linux.suse)
  • replace with / in tcsh/csh
    ... i remembered seeing someone saying there is a simple keyboard shortcut ... windows program output, for example). ...
    (comp.unix.shell)