Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You cannot specify initialisers for non-<code>static</code> members that way -- you would normally need to declare the array and then populate it inside the constructor... Except that, in fact there is no way to initialise <code>const</code> member arrays in C++ (see <a href="https://stackoverflow.com/questions/161790/initialize-a-const-array-in-a-class-initializer-in-c">this thread</a>).</p> <p>If you are prepared to share <code>MainMessages</code> amongst all instances of <code>CScrollingListDlg</code> (which I suspect was your intention all along), you should make it <code>static</code>, in which case you can declare:</p> <pre><code>static const decodeUINT MainMessages[]; // "struct" keyword unnecessary </code></pre> <p>inside the class definition of <code>CScrollingListDlg</code>, and then define it outside the class:</p> <pre><code>const CScrollingListDlg::decodeUINT CScrollingListDlg::MainMessages[] = { WM_PAINT, DoPaintMain, WM_DESTROY, DoDestroyMain, WM_QUIT, DoDestroyMain, WM_COMMAND, DoCommandMain, // The comma *is* allowed -- thanks Josh! }; </code></pre> <p>In order for this to actually compile, you'll need to make <code>DoPaintMain()</code>, <code>DoDestroyMain()</code>, etc. <code>static</code> as well -- as it stands, they are all per-object methods that implicitly take a <code>this</code> pointer, so they can't actually be contained in a function pointer of type <code>LRESULT (*Fxn)(HWND, UINT, WPARAM, LPARAM)</code>. (You could leave them as non-static methods and change the pointer type in <code>decodeUINT</code> to a pointer-to-member-function type, but that's probably not what you want.)</p> <p><strong>[EDIT: Thanks to Josh for some helpful comments!]</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload