Re: Windows Procedural Programming



* 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.


[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: Microsoft Says Recovery from Malware Becoming Impossible
    ... Windows malware scourge, a Microsoft security official said businesses ... You say MS takes standards and alters them so they do not interop, ...
    (microsoft.public.security)
  • Linux is the product of Standards - Re: Linuxes are all proprietary.
    ... thinking in terms of standards that will help them maintain access to ... have to keep a copy of Windows 95 on one of my hard drives so that I ... Extended integration costs. ... Extended Integration costs (due to API changes by Microsoft). ...
    (sci.physics)
  • Linux is the product of Standards - Re: Linuxes are all proprietary.
    ... thinking in terms of standards that will help them maintain access to ... have to keep a copy of Windows 95 on one of my hard drives so that I ... Extended integration costs. ... Extended Integration costs (due to API changes by Microsoft). ...
    (comp.os.linux.development.apps)
  • Re: Executable enty points incorrectly documented
    ... You wrote that WinMain is not a starting function in CRT, but an user-defined entry point for a Windows application. ... I believe that the fact that this function is called by the C/C++ runtime clearly backs my opinion that WinMain has nothing to do with the operating system. ... Even if WinMain documentation remains in Windows SDK it would be wise to explicitly state that support for this entry point is provided by the C/C++ runtime rather than Windows itself. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Believe me, you WANT to read this!
    ... What is required is standards that may be used by ... But MS have _not_ brought down the price of Windows or Office to '5 ... A recent claim by MS was that there was no innovation in browsers. ...
    (comp.lang.cobol)