Call SendMessage(Combo1.hWnd, CB_SHOWDROPDOWN, 1, ByVal 0&)
Call SendMessage(Combo1.hWnd, CB_SHOWDROPDOWN, 1, 0&)
上面两句不一样吗?

解决方案 »

  1.   

    ByVal是传递值 源数据不会被修改
    你可以把这个值当作自己的局部变量来使用ByRef是传递地址,源数据可能被修改
    你对这个变量的操作将对你传入的那个变量产生影响,就像指针的感觉你这里用的ByVal是一种显式声明,因为默认情况下是ByRef按址传递的。我们所讨论的是在VB6.0的情况下,而在VB.NET下,默认情况为ByVal按值传递。
      

  2.   

    ByVal是按值传递
    ByRef是按地址传递
    默认情况下是ByRef
    所以可以不写.
      

  3.   

    ByRef是传引用,将变量的地址压入堆栈,是VB默认的参数传递模式
    ByVal是传值,将变量本身压入堆栈
    SendMessage的lParam既可以是指针,又可以是值
    当它需要0值时,当然写ByVal 0&
      

  4.   

    CB_SHOWDROPDOWN
    An application sends a CB_SHOWDROPDOWN message to show or hide the list box of a combo box that has the CBS_DROPDOWN or CBS_DROPDOWNLIST style. CB_SHOWDROPDOWN 
    wParam = (WPARAM) (BOOL) fShow;     // the show/hide flag 
    lParam = 0;                         // not used; must be zero 
     
    Parameters
    fShow 
    Value of wParam. Specifies whether the drop-down list box is to be shown or hidden. A value of TRUE shows the list box; a value of FALSE hides it. 
    Return Values
    The return value is always TRUE. Res
    This message has no effect on a combo box created with the CBS_SIMPLE style. QuickInfo
      Windows NT: Requires version 3.1 or later.
      Windows: Requires Windows 95 or later.
      Windows CE: Requires version 1.0 or later.
      Header: Declared in winuser.h.