In VB.Net How do you use the "ScrollWindowEx" function?

S

Scott Gunn

I have looked all over the net for an example on how to use this function
but got no joy, lots of jargon explaining the function but no examples.

In VB.Net the hwnd has gone there was one in vb6 - I tried using Handle but
nothing happens

Can anyone shed some light on how to use this function or give an example?

Many Thanks
TBS
 
T

Tom Shelton

I have looked all over the net for an example on how to use this function
but got no joy, lots of jargon explaining the function but no examples.

In VB.Net the hwnd has gone there was one in vb6 - I tried using Handle but
nothing happens

Can anyone shed some light on how to use this function or give an example?

Many Thanks
TBS

The handle property is the hWnd. You have probably declared your
function incorrectly... Can you post some example code (including your
declaration of ScrollWindowEx)? It would go a long way to helping you.

You may also want to look at the forms AutoScroll property to see if
this helps you in accomplishing your goal.

HTH
 
S

Scott Gunn

Here is my sample code:

Declare Function ScrollWindowEx Lib "user32" (ByVal hwnd As Integer, ByVal
dx As Integer, ByVal dy As Integer, ByRef lprcScroll As Rectangle, ByRef
lprcClip As Rectangle, ByVal hrgnUpdate As Integer, ByRef lprcUpdate As
Rectangle, ByVal fuScroll As Integer) As Integer

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Const SW_INVALIDATE As Integer = 2
ScrollWindowEx(Me.Handle.ToInt32, 0, -10, Nothing, Nothing, Nothing,
Nothing, SW_INVALIDATE)
End Sub

Many Thanks
TBS
 
M

Mattias Sjögren

ScrollWindowEx(Me.Handle.ToInt32, 0, -10, Nothing, Nothing, Nothing,
Nothing, SW_INVALIDATE)

Nothing isn't the same as a null pointer. What you're doing here is to
pass in rectangles initialized to their default values {0,0,0,0}, and
since such rects are empty I guess nothing happens.

To pass in a null pointer, change the parameter type to ByVal As
IntPtr and pass IntPtr.Zero.



Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top