D - A little trick
- Patrick Down (24/24) Aug 22 2002 Here's a little trick I've used when building
- Pavel Minayev (4/12) Aug 22 2002 A neat one! Never really thought of the fact that struct members
- Walter (1/1) Aug 24 2002 I love it when neat things like this are discovered!
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. :-)
Aug 22 2002
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.
Aug 22 2002
I love it when neat things like this are discovered!
Aug 24 2002