Subj : Re: Windows Procedural Programming To : comp.programming From : alfps Date : Mon Jul 25 2005 02:56 am * 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? .