473,326 Members | 2,134 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Need ScrollWindowEx Calling Help

Hello

I'm trying to scroll a region of graphics, the best way I can see is to use
the ScrollWindowEx API because it is designed for doing this

However it doesn't work correctly, Why?

Here is my code:

Public Class Win32
<DllImport("user32.dll")> _
Public Shared Function ScrollWindowEx(ByVal hWnd As IntPtr, ByVal dx As
Integer, ByVal dy As Integer, <MarshalAs(UnmanagedType.Struct)> ByVal
prcScroll As Rectangle, <MarshalAs(UnmanagedType.Struct)> ByVal prcClip As
Rectangle, ByVal hrgnUpdate As IntPtr,
<System.Runtime.InteropServices.Out(), MarshalAs(UnmanagedType.Struct)>
ByRef prcUpdate As Rectangle, <MarshalAs(UnmanagedType.U4)> ByVal flags As
Integer) As Integer
End Function
End Class

Private Sub barScroll_Scroll(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.ScrollEventArgs) Handles barScroll.Scroll
Dim rt As Rectangle = New Rectangle
Dim rtout As Rectangle = New Rectangle(0, 0, 10, 10)
Dim rtin As Rectangle = New Rectangle(20, 20, 100, 100)
Dim rr As Integer = Win32.ScrollWindowEx(Handle, 0, 10, rtin, rt,
IntPtr.Zero, rtout, 0)
End Sub

rr is the return from the ScrollWindowEx function and this returns 0 but
nothing happens on the screen.

err.LastDllError returns 993 which means Invalid access to memory location.

If I change this:
Dim rr As Integer = Win32.ScrollWindowEx(Handle, 0, 10, rtin, rt,
IntPtr.Zero, rtout, 0)

To this:
Dim rr As Integer = Win32.ScrollWindowEx(Handle, 0, 10, rectangle.empty,
rectangle.empty, IntPtr.Zero, rectangle.empty, 0)

the whole screen scrolls as it should do, which kinda says the parameters
are wrong.

Can anyone help?

Scott
Nov 21 '05 #1
0 1155

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
0
by: Tony Liu | last post by:
Hi, I am having problem to scroll only a partion of a window using the ScrollWindowEx api function. The code is below and any help is pleased. Thanks in advance. private extern int...
3
by: Scott Gunn | last post by:
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...
3
by: Scott Gunn | last post by:
Hello all I'm trying to use the scrollwindowex api however I have the same problem as this guy had. There is an answer here in the reply. I just need some help converting it to VB.Net >Thanks...
3
by: Ivonne Riedel | last post by:
Working on an incremental drawing algorithm I am facing a problem PInvoking ScrollWindowEx: The code is as follows... C#: public static extern int ScrollWindowEx(IntPtr hWnd, int dx, int...
0
by: U S Contractors Offering Service A Non-profit | last post by:
Brilliant technology helping those most in need Inbox Reply U S Contractors Offering Service A Non-profit show details 10:37 pm (1 hour ago) Brilliant technology helping those most in need ...
0
by: evan | last post by:
Hi, Is anyone able to give me an example on how to scroll the contents of a ListBox without forcing the user to click on the scroll up/down internal buttons? ============================== I...
5
by: bean330 | last post by:
Hey, I'm somewhat new to C# and I need a little help, please! I'm selecting a bunch of records, setting properties on a COM executable and then calling a method on that executable to run. I...
0
by: akshaycjoshi | last post by:
I am reading a book which says Even though unboxed value types don't have a type object pointer, you can still call virtual methods (such as Equals, GetHashCode, or ToString) inherited or...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.