473,624 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("use r32.dll")> _
Public Shared Function ScrollWindowEx( ByVal hWnd As IntPtr, ByVal dx As
Integer, ByVal dy As Integer, <MarshalAs(Unma nagedType.Struc t)> ByVal
prcScroll As Rectangle, <MarshalAs(Unma nagedType.Struc t)> ByVal prcClip As
Rectangle, ByVal hrgnUpdate As IntPtr,
<System.Runtime .InteropService s.Out(), MarshalAs(Unman agedType.Struct )>
ByRef prcUpdate As Rectangle, <MarshalAs(Unma nagedType.U4)> ByVal flags As
Integer) As Integer
End Function
End Class

Private Sub barScroll_Scrol l(ByVal sender As System.Object, ByVal e As
System.Windows. Forms.ScrollEve ntArgs) Handles barScroll.Scrol l
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.ScrollWin dowEx(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.LastDllErro r returns 993 which means Invalid access to memory location.

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

To this:
Dim rr As Integer = Win32.ScrollWin dowEx(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 1169

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

Similar topics

19
4087
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 the code that implements managing unbound controls on forms given the superior performance of unbound controls in a client/server environment. I can easily understand a newbie using bound controls or someone with a tight deadline. I guess I need...
0
2388
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 ScrollWindowEx (IntPtr handle, int dx, int dy, Rectangle lprcScroll , Rectangle lprcClip, IntPtr hrgnUpdate, out Rectangle lprcUpdate, int fuScroll);
3
2683
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 - 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
3
1533
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 Peter, it works. I have another question for you. What does the >clip rectangle passed on the 5th argument does? > >Thanks
3
4814
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 dy, IntPtr scrollRect, IntPtr clipRect, IntPtr hrgn, ref Rectangle updateRect, uint flags);
0
3945
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 Inbox Reply from Craig Somerford <uscos@2barter.net> hide details 10:25 pm (3 minutes ago)
0
2335
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 am wanting to draw my own non-client area (including the scrollbar). I have had the following ideas but each idea has failed:
5
2026
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 want to run the executable in separate threads because they can be long-running and it would be optimal for us to run a bunch simultaneously. I've got that part working - it's pretty easy in C#. What I'm having a hard time with is managing the...
0
1802
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 overridden by the type. The reason is because the CLR can just call these methods nonvirtually and System.ValueType overrides all of these virtual methods and expects the value in the this argument to refer to an unboxed value type instance. Remember, a...
0
8174
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8478
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7164
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4082
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2607
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1786
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1485
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.