Announcement

Collapse
No announcement yet.

Listbox_SetSel macro

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Listbox_SetSel macro

    Just a curious thought--

    Why is the Listbox_SetSel macro have parameters in a different order than MS's documentation?
    My commctrl.inc has


    #IF %DEF(%USEMACROS)
    MACRO Listbox_SetSel (hListBox, fSelect, index) = SendMessage(hListBox, %LB_SETSEL, fSelect, index)
    #ELSE
    FUNCTION Listbox_SetSel (BYVAL hListBox AS DWORD, BYVAL fSelect AS LONG, _
    BYVAL index AS LONG
    ) AS LONG
    FUNCTION = SendMessage(hListBox, %LB_SETSEL, fSelect, index)
    END FUNCTION
    #ENDIF


    http://msdn.microsoft.com/en-us/libr...59(VS.85).aspx has

    int ListBox_SetSel(
    HWND hwndCtl,
    int index,
    BOOL fSelect

    );


    This is no big deal; I am just wondering why this is.

    Any thoughts?
    Last edited by Bill Scharf; 9 Jun 2008, 08:49 AM.
    Bill Scharf

  • #2
    My API doc for LB_SETSEL message has wParam=flags, lparam=index, meaning the PB-created macros and functions arej just fine.

    LsitBox_SetSel (at microsoft link provided) is documented to be a MACRO. Since you don't have the source code used to convert that Microsoft Macro to an appropriate SendMesssage call, you don't know how its done and it's possible Microsoft's "macro writer" was in a strange mood when he did that. (i.e, careless)

    The bottom line is, you can't assume Microsoft created macros the same way PowerBASIC Inc. created macros.
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Why is the Listbox_SetSel macro have parameters in a different order than MS's documentation?
      Because the MSDN documentation is wrong.

      The definition of the macro, included in WindowsX.h, is as follows:

      Code:
      #define ListBox_SetSel(hwndCtl, fSelect, index)     ((int)(DWORD)SNDMSG((hwndCtl), LB_SETSEL, (WPARAM)(BOOL)(fSelect), (LPARAM)(index)))
      Forum: http://www.jose.it-berater.org/smfforum/index.php

      Comment


      • #4
        Thanks! It is always nice to see examples of PB being more "on the ball" than M$
        Bill Scharf

        Comment

        Working...
        X