Results 1 to 2 of 2

Thread: Passing gas - er a null

  1. #1
    Guest

    Question

    Heya Folks,
    I want to understand API val passing techniques as much as the avg Joe and am stumbling on the way to pass Nulls or Zeros to a DLL. The function in question is the ScrollWindowEx:

    Declare Function ScrollWindowEx& Lib "user32" _
    (ByVal hwnd As Long, _
    ByVal dx As Long, _
    ByVal dy As Long, _
    lprcScroll As RECT, _
    lprcClip As RECT, _ <--Is not required
    ByVal hrgnUpdate As Long, _ and somehow you
    lprcUpdate As RECT, _ <--can pass Zero or
    ByVal fuScroll As Long) to these parameters

    Which scrolls all or part of a window’s client area with additional options. ScrollWindowExBynum specifies the rectangle pointers as Long to facilitate passing zero as a parameter.

    I am guessing ScrollWindowExByNum looks like this:
    Declare Function ScrollWindowExByNum& Lib "user32" alias _
    "ScrollWindowEx" (ByVal hwnd As Long, _
    ByVal dx As Long, _
    ByVal dy As Long, _
    ByVal lprcScroll As Long, _
    ByVal lprcClip As Long,
    ByVal hrgnUpdate As Long,
    ByVal lprcUpdate As Long,
    ByVal fuScroll As Long)

    ..where the Rect has been replaced by a pointer of some sort

    OK I want to pass a zero to lprcClip (I'm scrolling the entire Rect) and get a "Type missmatch" error when
    I run this code
    Call ScrollWindowExBynum(UserControl.hWnd, _
    dx, _
    dy, _
    udpRectSrc, _
    Null, _
    lopRegionUpdate, _
    Null, _
    SW_SCROLLCHILDREN)

    I think I just ain't getting how to pass the null or a zero to the dll.

    I know this is something simple...but I'm a simpleton
    Much thanx...
    ElRey

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    hmm, you're kinda giong overboard changing the Declaration.

    you only need to change one parameter, make it look like this
    Code:
    Declare Function ScrollWindowExByNum Lib "user32" _ 
    (ByVal hwnd As Long, _ 
    ByVal dx As Long, _ 
    ByVal dy As Long, _ 
    lprcScroll As RECT, _ <------------------------------This Stays the same
    ByVal lprcClip As Long, _ <--These 2 params
    ByVal hrgnUpdate As Long, _ 
    ByVal lprcUpdate As long, _ <--are all we changed
    ByVal fuScroll As Long) As Long

    where you were getting your error is you tried to pass in the Rect where you had declared a long, the function was expecting a pointer to the rectangle, not the rectangle itself.




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width