PDA

Click to See Complete Forum and Search --> : Passing gas - er a null


May 14th, 2000, 10:30 PM
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

Sam Finch
May 14th, 2000, 11:11 PM
hmm, you're kinda giong overboard changing the Declaration.

you only need to change one parameter, make it look like this

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.