Thread overview | |||||
---|---|---|---|---|---|
|
August 23, 2002 A little trick | ||||
---|---|---|---|---|
| ||||
Here's a little trick I've used when building a module for various windows functions that aren't in Walter's windows.d yet. A number of structures in the windows API require the first member to be a UINT with the structure size in it. Which can be initialized in the structure definition like this. struct MENUITEMINFO { UINT cbSize = MENUITEMINFO.size; UINT fMask; UINT fType; UINT fState; UINT wID; HMENU hSubMenu; HBITMAP hbmpChecked; HBITMAP hbmpUnchecked; DWORD dwItemData; LPTSTR dwTypeData; UINT cch; HBITMAP hbmpItem; } Ok, it's not much of a trick, but simple things make me happy. :-) |
August 23, 2002 Re: A little trick | ||||
---|---|---|---|---|
| ||||
Posted in reply to Patrick Down | On Fri, 23 Aug 2002 03:20:24 +0000 (UTC) Patrick Down <pat@codemoon.com> wrote:
>
> Here's a little trick I've used when building
> a module for various windows functions that
> aren't in Walter's windows.d yet. A number
> of structures in the windows API require the
> first member to be a UINT with the structure
> size in it. Which can be initialized in the
> structure definition like this.
A neat one! Never really thought of the fact that struct members can be initialized... It is also interesting that it can determine size of the struct before it had even been declared.
|
August 25, 2002 Re: A little trick | ||||
---|---|---|---|---|
| ||||
Posted in reply to Patrick Down | I love it when neat things like this are discovered! |
Copyright © 1999-2021 by the D Language Foundation