Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #13077

Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and resources"

From "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>
Newsgroups comp.lang.c++, comp.os.ms-windows.programmer.win32
Subject Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and resources"
Date 2012-01-04 16:40 +0100
Organization A noiseless patient Spider
Message-ID <je1ru3$4ro$1@dont-email.me> (permalink)
References <jde6bi$cjb$2@dont-email.me> <jdvvms$cg1$1@speranza.aioe.org> <je09d4$lub$1@dont-email.me> <eg4et8-trt.ln1@satorlaser.homedns.org>

Cross-posted to 2 groups.

Show all headers | View raw


On 04.01.2012 15:32, Ulrich Eckhardt wrote:
> Am 04.01.2012 02:18, schrieb Alf P. Steinbach:
>> On 03.01.2012 23:33, RaZiel wrote:
>>> On 28.12.2011 05:36, Alf P. Steinbach wrote:
>>>> <url:
>>>> http://learnwinapi.wordpress.com/2011/12/28/lesson-4-dialogs-and-resources/>
>>>>
>>>>
>>>
>>> Excuse my ignorance. Why does WindowSpec contain a construtor? Isn't it
>>> a POD?
>>
>> Repeating the answer I posted to the same question on the blog:
>>
>>
>> <quote>
>> Well, WindowSpec has a constructor just for convenience. [...]
>> </quote>
>
> I think factory function are a good alternative, especially if you want
> to keep the compiler-generated default constructor and
> by-any-C++-standard POD-ness.

Factory functions are nice for some things, but in general and in this 
case it's just more to write than simply defining a constructor.

In other words, there was no particular reason to use a factory function.



> That said, what I find unclear is the point of single-wchar_t fields in
> that struct. I have an idea what this hack does and how it works, but
> putting that into public members seems like a bad idea to me.

They represent the terminating nulls of null-terminated strings.


> Another thing I noticed on cursory reading was that you explicitly use
> wchar_t but neither MESSAGEBOXPARAMSW nor MessageBoxIndirectW().

[windows.h] does not IMHO define any better, more readable name for 
`wchar_t`.

However, [windows.h] does define e.g. MSGBOXPARAMS as a more readable 
alternative for MSGBOXPARAMSW, and it is not only more readable but also 
more easy to look up in the documentation (e.g., right-click and google).

In modern Windows programming there is no practical reason to reserve 
that name for places where it might work to instead have it defined as 
MSGBOXPARAMSA, since (one just ensures that) it will never be defined as 
anything but MSGBOXPARAMSW.


> Cheers and thank you anyway!
>
> Uli

Cheers,

- ALf

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Ann: lesson 4 in Windows API level GUI programming "Dialogs and resources" "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2011-12-28 05:36 +0100
  Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and resources" Leigh Johnston <leigh@i42.co.uk> - 2011-12-29 19:17 +0000
  Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and resources" RaZiel <raziel_206_@hotmail.org> - 2012-01-03 23:33 +0100
    Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and resources" Leigh Johnston <leigh@i42.co.uk> - 2012-01-03 22:37 +0000
    Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and resources" "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-01-04 02:18 +0100
      Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and resources" Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-01-04 15:32 +0100
        Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and resources" "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-01-04 16:40 +0100
  Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and resources" Christopher <cpisz@austin.rr.com> - 2012-01-03 17:06 -0800
    Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and resources" Leigh Johnston <leigh@i42.co.uk> - 2012-01-04 01:16 +0000
      Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and   resources" Ian Collins <ian-news@hotmail.com> - 2012-01-04 15:20 +1300
        Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and   resources" Leigh Johnston <leigh@i42.co.uk> - 2012-01-04 02:58 +0000
          Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and resources" Miles Bader <miles@gnu.org> - 2012-01-04 12:36 +0900
      Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and resources" "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-04 17:49 +0000
        Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and resources" Leigh Johnston <leigh@i42.co.uk> - 2012-01-04 18:23 +0000
          Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and resources" "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-04 18:48 +0000
            Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and resources" Leigh Johnston <leigh@i42.co.uk> - 2012-01-04 19:01 +0000
              Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and resources" "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-04 20:56 +0000
                Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and resources" Leigh Johnston <leigh@i42.co.uk> - 2012-01-04 21:04 +0000
                Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and resources" "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-04 22:04 +0000
    Re: Ann: lesson 4 in Windows API level GUI programming "Dialogs and resources" Paavo Helde <myfirstname@osa.pri.ee> - 2012-01-04 01:45 -0600

csiph-web