Author Topic: MSG and other Windows STRUCs  (Read 2461 times)

Offline afk

  • Jr. Member
  • *
  • Posts: 11
MSG and other Windows STRUCs
« on: March 07, 2012, 05:48:35 PM »
Until recently, when writing a Windows app I followed the practice of copying the complete STRUC and all its members into an .INC  file and creating a local label for it :
Code: [Select]
    appmsg:
    istruc MSG
        at MSG.hwnd,               dd    NULL
        at MSG.message,            dd    NULL
        at MSG.wParam,             dd    NULL
        at MSG.lParam,             dd    NULL
        at MSG.time,               dd    NULL
        at MSG.pt,                 dd    NULL
    iend

But I've found that simply defining a variable postpended with  _size works fine and the app appears to be stable (and a lot less cluttered) :

Code: [Select]
appmsg times MSG_size db 0

Is there anything wrong with this shortcut ?
Thanks in advance.
afk

Offline Bryant Keller

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 360
  • Country: us
    • About Bryant Keller
Re: MSG and other Windows STRUCs
« Reply #1 on: March 08, 2012, 12:28:45 AM »
Nothing at all wrong with that. In fact, that's what the '_size' equate is defined for. If you create your variables in the .bss section, it looks even cleaner (imho):

Code: [Select]
section .bss
appmsg: resb MSG_size

About Bryant Keller
bkeller@about.me

Offline afk

  • Jr. Member
  • *
  • Posts: 11
Re: MSG and other Windows STRUCs
« Reply #2 on: March 08, 2012, 04:24:32 AM »
Hi Bryant,
Thanks again.
afk