Need Help With Translation C#? to VB

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Scott Gunn

    #1

    Need Help With Translation C#? to VB

    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
    [color=blue]
    >Thanks Peter, it works. I have another question for you. What does the
    >clip rectangle passed on the 5th argument does?
    >
    >Thanks
    >Tony
    >
    >
    >"Peter Huang [MSFT]" <v-phuang@online.m icrosoft.com> wrote in message
    >news:VQ757BURD HA.1720@cpmsftn gxa09.phx.gbl.. .[color=green]
    >> Hi Tony,
    >>
    >> I consult the MSDN and find that the RECT structure required by the ?
    >> °ScrollWindowEx ¡± API is different from the class ¡°Rectangle¡±. I think
    >> you may declare your ¡°ScrollWindowE x¡± API as follows.
    >> public class win32
    >> {
    >> [DllImport("user 32.dll")]
    >> public static extern int ScrollWindowEx(
    >> IntPtr hWnd,
    >> int dx,
    >> int dy,
    >> [MarshalAs(Unman agedType.Struct )] ref Rectangle prcScroll,
    >> [MarshalAs(Unman agedType.Struct )] ref Rectangle prcClip,
    >> IntPtr hrgnUpdate,
    >> [MarshalAs(Unman agedType.Struct )] out Rectangle prcUpdate,
    >> [MarshalAs(Unman agedType.U4)] int flags);
    >>
    >> }
    >> Then you may invoke the API as below.
    >> private void button1_Click(o bject sender, System.EventArg s e)
    >> {
    >> Rectangle rt = new Rectangle();
    >> Rectangle rtout = new Rectangle(0,0,1 0,10);
    >> Rectangle rtin = new
    >> Rectangle(20,20 ,richTextBox1.W idth,richTextBo x1.He ight);
    >> int rr=win32.Scroll WindowEx(richTe xtBox1.Handle,0 ,10,r ef rtin,ref
    >> rt,IntPtr.Zero, out rtout,0);
    >> System.Console. WriteLine(rr.To String());
    >> }
    >>
    >> Hope this will help.
    >>
    >> Best regards,
    >> Peter Huang
    >>
    >> Regards,
    >>
    >> Peter Huang
    >> =============
    >> This posting is provided "AS IS" with no warranties, and confers no[/color]
    >rights.[color=green]
    >>
    >> --------------------[color=darkred]
    >> >From: "Tony" <engineliu@hotm ail.com>
    >> >Subject: Calling the ScrollWindowEx API
    >> >Date: Fri, 4 Jul 2003 08:45:32 +0800
    >> >Lines: 21
    >> >X-Priority: 3
    >> >X-MSMail-Priority: Normal
    >> >X-Newsreader: Microsoft Outlook Express 6.00.3790.0
    >> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
    >> >Message-ID: <ee1WWWcQDHA.28 32@TK2MSFTNGP10 .phx.gbl>
    >> >Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
    >> >NNTP-Posting-Host: cm203-168-247-148.hkcable.com .hk 203.168.247.148
    >> >Path: cpmsftngxa09.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTN GP10.phx.gbl
    >> >Xref: cpmsftngxa09.ph x.gbl[/color][/color][/color]
    microsoft.publi c.dotnet.langua ges.csharp:3051 9[color=blue][color=green][color=darkred]
    >> >X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
    >> >
    >> >Hi, I am having problem to scroll only a partion of a window using the
    >> >ScrollWindow Ex api function. The code is below and any help is pleased.
    >> >Thanks in advance.
    >> >
    >> >
    >> >[DllImport("user 32.dll")]
    >> >private extern int ScrollWindowEx (IntPtr handle, int dx, int dy,[/color][/color]
    >Rectangle[color=green][color=darkred]
    >> >lprcScroll , Rectangle lprcClip, IntPtr hrgnUpdate, out Rectangle
    >> >lprcUpdate, int fuScroll);
    >> >
    >> >Rectangle rt;
    >> >
    >> >// This works
    >> >ScrollWindowEx (Handle, 0, 30, Rectangle.Empty , Rectangle.Empty ,[/color]
    >> IntPtr.Zero,[color=darkred]
    >> >out rt, 0);
    >> >
    >> >// This doesn't work
    >> >ScrollWindowEx (Handle, 0, 30, new Rectangle(20, 20, ClientSize.Widt h,
    >> >ClientSize.Hei ght), Rectangle.Empty , IntPtr.Zero, out rt, 0);[/color][/color][/color]

    URL: http://www.pcreview.co.uk/forums/thread-1349023.php

    I have the same problem

    This works:
    ScrollWindowEx( Handle, 0, 30, Rectangle.Empty , Rectangle.Empty , IntPtr.Zero,
    Rectangle.Empty , 0)

    This doesn't work
    ScrollWindowEx( Handle, 0, 30, new Rectangle(20, 20, ClientSize.Widt h,
    ClientSize.Heig ht), Rectangle.Empty , IntPtr.Zero, rectangle.empty , 0)

    Many Thanks
    Scott


  • David Anton

    #2
    RE: Need Help With Translation C#? to VB

    Our Instant VB C# to VB.NET converter (www.instantvb.com) produces the
    following (assuming I've pasted the C# code correctly):

    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)> ByRef
    prcScroll As Rectangle, <MarshalAs(Unma nagedType.Struc t)> ByRef prcClip As
    Rectangle, ByVal hrgnUpdate As IntPtr, <System.Runtime .InteropService s.Out()>
    (MarshalAs(Unma nagedType.Struc t)) ByRef prcUpdate As Rectangle,
    <MarshalAs(Unma nagedType.U4)> ByVal flags As Integer) As Integer

    End Function
    End Class

    Private Sub button1_Click(B yVal sender As Object, ByVal e As
    System.EventArg s)
    Dim rt As Rectangle = New Rectangle()
    Dim rtout As Rectangle = New Rectangle(0,0,1 0,10)
    Dim rtin As Rectangle = New
    Rectangle(20,20 ,richTextBox1.W idth,richTextBo x1.Height)
    Dim rr As
    Integer=win32.S crollWindowEx(r ichTextBox1.Han dle,0,10,rtin,r t,IntPtr.Zero,r tout,0)
    System.Console. WriteLine(rr.To String())
    End Sub

    David Anton
    Source code converters: Convert between C#, C++, Java, and VB with the most accurate and reliable source code converters

    Home of:
    Instant C#: VB.NET to C# Converter
    Instant VB: C# to VB.NET Converter
    Instant J#: VB.NET to J# Converter

    "Scott Gunn" wrote:
    [color=blue]
    > 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
    >[color=green]
    > >Thanks Peter, it works. I have another question for you. What does the
    > >clip rectangle passed on the 5th argument does?
    > >
    > >Thanks
    > >Tony
    > >
    > >
    > >"Peter Huang [MSFT]" <v-phuang@online.m icrosoft.com> wrote in message
    > >news:VQ757BURD HA.1720@cpmsftn gxa09.phx.gbl.. .[color=darkred]
    > >> Hi Tony,
    > >>
    > >> I consult the MSDN and find that the RECT structure required by the ?
    > >> °ScrollWindowE x¡± API is different from the class ¡°Rectangle¡ ±. I think
    > >> you may declare your ¡°ScrollWindo wEx¡± API as follows.
    > >> public class win32
    > >> {
    > >> [DllImport("user 32.dll")]
    > >> public static extern int ScrollWindowEx(
    > >> IntPtr hWnd,
    > >> int dx,
    > >> int dy,
    > >> [MarshalAs(Unman agedType.Struct )] ref Rectangle prcScroll,
    > >> [MarshalAs(Unman agedType.Struct )] ref Rectangle prcClip,
    > >> IntPtr hrgnUpdate,
    > >> [MarshalAs(Unman agedType.Struct )] out Rectangle prcUpdate,
    > >> [MarshalAs(Unman agedType.U4)] int flags);
    > >>
    > >> }
    > >> Then you may invoke the API as below.
    > >> private void button1_Click(o bject sender, System.EventArg s e)
    > >> {
    > >> Rectangle rt = new Rectangle();
    > >> Rectangle rtout = new Rectangle(0,0,1 0,10);
    > >> Rectangle rtin = new
    > >> Rectangle(20,20 ,richTextBox1.W idth,richTextBo x1.He ight);
    > >> int rr=win32.Scroll WindowEx(richTe xtBox1.Handle,0 ,10,r ef rtin,ref
    > >> rt,IntPtr.Zero, out rtout,0);
    > >> System.Console. WriteLine(rr.To String());
    > >> }
    > >>
    > >> Hope this will help.
    > >>
    > >> Best regards,
    > >> Peter Huang
    > >>
    > >> Regards,
    > >>
    > >> Peter Huang
    > >> =============
    > >> This posting is provided "AS IS" with no warranties, and confers no[/color]
    > >rights.[color=darkred]
    > >>
    > >> --------------------
    > >> >From: "Tony" <engineliu@hotm ail.com>
    > >> >Subject: Calling the ScrollWindowEx API
    > >> >Date: Fri, 4 Jul 2003 08:45:32 +0800
    > >> >Lines: 21
    > >> >X-Priority: 3
    > >> >X-MSMail-Priority: Normal
    > >> >X-Newsreader: Microsoft Outlook Express 6.00.3790.0
    > >> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
    > >> >Message-ID: <ee1WWWcQDHA.28 32@TK2MSFTNGP10 .phx.gbl>
    > >> >Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
    > >> >NNTP-Posting-Host: cm203-168-247-148.hkcable.com .hk 203.168.247.148
    > >> >Path: cpmsftngxa09.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTN GP10.phx.gbl
    > >> >Xref: cpmsftngxa09.ph x.gbl[/color][/color]
    > microsoft.publi c.dotnet.langua ges.csharp:3051 9[color=green][color=darkred]
    > >> >X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
    > >> >
    > >> >Hi, I am having problem to scroll only a partion of a window using the
    > >> >ScrollWindow Ex api function. The code is below and any help is pleased.
    > >> >Thanks in advance.
    > >> >
    > >> >
    > >> >[DllImport("user 32.dll")]
    > >> >private extern int ScrollWindowEx (IntPtr handle, int dx, int dy,[/color]
    > >Rectangle[color=darkred]
    > >> >lprcScroll , Rectangle lprcClip, IntPtr hrgnUpdate, out Rectangle
    > >> >lprcUpdate, int fuScroll);
    > >> >
    > >> >Rectangle rt;
    > >> >
    > >> >// This works
    > >> >ScrollWindowEx (Handle, 0, 30, Rectangle.Empty , Rectangle.Empty ,
    > >> IntPtr.Zero,
    > >> >out rt, 0);
    > >> >
    > >> >// This doesn't work
    > >> >ScrollWindowEx (Handle, 0, 30, new Rectangle(20, 20, ClientSize.Widt h,
    > >> >ClientSize.Hei ght), Rectangle.Empty , IntPtr.Zero, out rt, 0);[/color][/color]
    >
    > URL: http://www.pcreview.co.uk/forums/thread-1349023.php
    >
    > I have the same problem
    >
    > This works:
    > ScrollWindowEx( Handle, 0, 30, Rectangle.Empty , Rectangle.Empty , IntPtr.Zero,
    > Rectangle.Empty , 0)
    >
    > This doesn't work
    > ScrollWindowEx( Handle, 0, 30, new Rectangle(20, 20, ClientSize.Widt h,
    > ClientSize.Heig ht), Rectangle.Empty , IntPtr.Zero, rectangle.empty , 0)
    >
    > Many Thanks
    > Scott
    >
    >
    >[/color]

    Comment

    • Scott Gunn

      #3
      Re: Need Help With Translation C#? to VB

      Hello

      Excellent, the conversion added some things I didn't however my orignal
      problem is still there

      I had to change the part:
      <System.Runtime .InteropService s.Out()> (MarshalAs(Unma nagedType.Struc t))

      To (Guessing):
      <System.Runtime .InteropService s.Out(), MarshalAs(Unman agedType.Struct )>

      The code as is does nothing though, I also had to change the ByRef to ByVal
      and things started to happen.
      but still the problem is:

      This works:
      ScrollWindowEx( Handle, 0, 30, Rectangle.Empty , Rectangle.Empty , IntPtr.Zero,
      Rectangle.Empty , 0)

      This doesn't work:
      ScrollWindowEx( Handle, 0, 30, new Rectangle(20, 20, ClientSize.Widt h,
      ClientSize.Heig ht), Rectangle.Empty , IntPtr.Zero, rectangle.empty , 0)

      Thanks for the conversion.
      Scott.


      "David Anton" <DavidAnton@dis cussions.micros oft.com> wrote in message
      news:4FA9CFE3-C356-47D5-BAC8-0C61010A4F99@mi crosoft.com...[color=blue]
      > Our Instant VB C# to VB.NET converter (www.instantvb.com) produces the
      > following (assuming I've pasted the C# code correctly):
      >
      > 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)> ByRef
      > prcScroll As Rectangle, <MarshalAs(Unma nagedType.Struc t)> ByRef prcClip As
      > Rectangle, ByVal hrgnUpdate As IntPtr,
      > <System.Runtime .InteropService s.Out()>
      > (MarshalAs(Unma nagedType.Struc t)) ByRef prcUpdate As Rectangle,
      > <MarshalAs(Unma nagedType.U4)> ByVal flags As Integer) As Integer
      >
      > End Function
      > End Class
      >
      > Private Sub button1_Click(B yVal sender As Object, ByVal e As
      > System.EventArg s)
      > Dim rt As Rectangle = New Rectangle()
      > Dim rtout As Rectangle = New Rectangle(0,0,1 0,10)
      > Dim rtin As Rectangle = New
      > Rectangle(20,20 ,richTextBox1.W idth,richTextBo x1.Height)
      > Dim rr As
      > Integer=win32.S crollWindowEx(r ichTextBox1.Han dle,0,10,rtin,r t,IntPtr.Zero,r tout,0)
      > System.Console. WriteLine(rr.To String())
      > End Sub
      >
      > David Anton
      > www.tangiblesoftwaresolutions.com
      > Home of:
      > Instant C#: VB.NET to C# Converter
      > Instant VB: C# to VB.NET Converter
      > Instant J#: VB.NET to J# Converter
      >
      > "Scott Gunn" wrote:
      >[color=green]
      >> 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
      >>[color=darkred]
      >> >Thanks Peter, it works. I have another question for you. What does the
      >> >clip rectangle passed on the 5th argument does?
      >> >
      >> >Thanks
      >> >Tony
      >> >
      >> >
      >> >"Peter Huang [MSFT]" <v-phuang@online.m icrosoft.com> wrote in message
      >> >news:VQ757BURD HA.1720@cpmsftn gxa09.phx.gbl.. .
      >> >> Hi Tony,
      >> >>
      >> >> I consult the MSDN and find that the RECT structure required by the ?
      >> >> °ScrollWindowEx ¡± API is different from the class ¡°Rectangle¡±. I
      >> >> think
      >> >> you may declare your ¡°ScrollWindowE x¡± API as follows.
      >> >> public class win32
      >> >> {
      >> >> [DllImport("user 32.dll")]
      >> >> public static extern int ScrollWindowEx(
      >> >> IntPtr hWnd,
      >> >> int dx,
      >> >> int dy,
      >> >> [MarshalAs(Unman agedType.Struct )] ref Rectangle prcScroll,
      >> >> [MarshalAs(Unman agedType.Struct )] ref Rectangle prcClip,
      >> >> IntPtr hrgnUpdate,
      >> >> [MarshalAs(Unman agedType.Struct )] out Rectangle prcUpdate,
      >> >> [MarshalAs(Unman agedType.U4)] int flags);
      >> >>
      >> >> }
      >> >> Then you may invoke the API as below.
      >> >> private void button1_Click(o bject sender, System.EventArg s e)
      >> >> {
      >> >> Rectangle rt = new Rectangle();
      >> >> Rectangle rtout = new Rectangle(0,0,1 0,10);
      >> >> Rectangle rtin = new
      >> >> Rectangle(20,20 ,richTextBox1.W idth,richTextBo x1.He ight);
      >> >> int rr=win32.Scroll WindowEx(richTe xtBox1.Handle,0 ,10,r ef rtin,ref
      >> >> rt,IntPtr.Zero, out rtout,0);
      >> >> System.Console. WriteLine(rr.To String());
      >> >> }
      >> >>
      >> >> Hope this will help.
      >> >>
      >> >> Best regards,
      >> >> Peter Huang
      >> >>
      >> >> Regards,
      >> >>
      >> >> Peter Huang
      >> >> =============
      >> >> This posting is provided "AS IS" with no warranties, and confers no
      >> >rights.
      >> >>
      >> >> --------------------
      >> >> >From: "Tony" <engineliu@hotm ail.com>
      >> >> >Subject: Calling the ScrollWindowEx API
      >> >> >Date: Fri, 4 Jul 2003 08:45:32 +0800
      >> >> >Lines: 21
      >> >> >X-Priority: 3
      >> >> >X-MSMail-Priority: Normal
      >> >> >X-Newsreader: Microsoft Outlook Express 6.00.3790.0
      >> >> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
      >> >> >Message-ID: <ee1WWWcQDHA.28 32@TK2MSFTNGP10 .phx.gbl>
      >> >> >Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
      >> >> >NNTP-Posting-Host: cm203-168-247-148.hkcable.com .hk 203.168.247.148
      >> >> >Path: cpmsftngxa09.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTN GP10.phx.gbl
      >> >> >Xref: cpmsftngxa09.ph x.gbl[/color]
      >> microsoft.publi c.dotnet.langua ges.csharp:3051 9[color=darkred]
      >> >> >X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
      >> >> >
      >> >> >Hi, I am having problem to scroll only a partion of a window using
      >> >> >the
      >> >> >ScrollWindow Ex api function. The code is below and any help is
      >> >> >pleased.
      >> >> >Thanks in advance.
      >> >> >
      >> >> >
      >> >> >[DllImport("user 32.dll")]
      >> >> >private extern int ScrollWindowEx (IntPtr handle, int dx, int dy,
      >> >Rectangle
      >> >> >lprcScroll , Rectangle lprcClip, IntPtr hrgnUpdate, out Rectangle
      >> >> >lprcUpdate, int fuScroll);
      >> >> >
      >> >> >Rectangle rt;
      >> >> >
      >> >> >// This works
      >> >> >ScrollWindowEx (Handle, 0, 30, Rectangle.Empty , Rectangle.Empty ,
      >> >> IntPtr.Zero,
      >> >> >out rt, 0);
      >> >> >
      >> >> >// This doesn't work
      >> >> >ScrollWindowEx (Handle, 0, 30, new Rectangle(20, 20, ClientSize.Widt h,
      >> >> >ClientSize.Hei ght), Rectangle.Empty , IntPtr.Zero, out rt, 0);[/color]
      >>
      >> URL: http://www.pcreview.co.uk/forums/thread-1349023.php
      >>
      >> I have the same problem
      >>
      >> This works:
      >> ScrollWindowEx( Handle, 0, 30, Rectangle.Empty , Rectangle.Empty ,
      >> IntPtr.Zero,
      >> Rectangle.Empty , 0)
      >>
      >> This doesn't work
      >> ScrollWindowEx( Handle, 0, 30, new Rectangle(20, 20, ClientSize.Widt h,
      >> ClientSize.Heig ht), Rectangle.Empty , IntPtr.Zero, rectangle.empty , 0)
      >>
      >> Many Thanks
      >> Scott
      >>
      >>
      >>[/color][/color]


      Comment

      • David Anton

        #4
        Re: Need Help With Translation C#? to VB

        Thanks for the bug report Scott - the fix will be in today's build.

        David Anton
        Source code converters: Convert between C#, C++, Java, and VB with the most accurate and reliable source code converters

        Home of:
        Instant C#: VB.NET to C# Converter
        Instant VB: C# to VB.NET Converter
        Instant J#: VB.NET to J# Converter

        "Scott Gunn" wrote:
        [color=blue]
        > Hello
        >
        > Excellent, the conversion added some things I didn't however my orignal
        > problem is still there
        >
        > I had to change the part:
        > <System.Runtime .InteropService s.Out()> (MarshalAs(Unma nagedType.Struc t))
        >
        > To (Guessing):
        > <System.Runtime .InteropService s.Out(), MarshalAs(Unman agedType.Struct )>
        >
        > The code as is does nothing though, I also had to change the ByRef to ByVal
        > and things started to happen.
        > but still the problem is:
        >
        > This works:
        > ScrollWindowEx( Handle, 0, 30, Rectangle.Empty , Rectangle.Empty , IntPtr.Zero,
        > Rectangle.Empty , 0)
        >
        > This doesn't work:
        > ScrollWindowEx( Handle, 0, 30, new Rectangle(20, 20, ClientSize.Widt h,
        > ClientSize.Heig ht), Rectangle.Empty , IntPtr.Zero, rectangle.empty , 0)
        >
        > Thanks for the conversion.
        > Scott.
        >
        >
        > "David Anton" <DavidAnton@dis cussions.micros oft.com> wrote in message
        > news:4FA9CFE3-C356-47D5-BAC8-0C61010A4F99@mi crosoft.com...[color=green]
        > > Our Instant VB C# to VB.NET converter (www.instantvb.com) produces the
        > > following (assuming I've pasted the C# code correctly):
        > >
        > > 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)> ByRef
        > > prcScroll As Rectangle, <MarshalAs(Unma nagedType.Struc t)> ByRef prcClip As
        > > Rectangle, ByVal hrgnUpdate As IntPtr,
        > > <System.Runtime .InteropService s.Out()>
        > > (MarshalAs(Unma nagedType.Struc t)) ByRef prcUpdate As Rectangle,
        > > <MarshalAs(Unma nagedType.U4)> ByVal flags As Integer) As Integer
        > >
        > > End Function
        > > End Class
        > >
        > > Private Sub button1_Click(B yVal sender As Object, ByVal e As
        > > System.EventArg s)
        > > Dim rt As Rectangle = New Rectangle()
        > > Dim rtout As Rectangle = New Rectangle(0,0,1 0,10)
        > > Dim rtin As Rectangle = New
        > > Rectangle(20,20 ,richTextBox1.W idth,richTextBo x1.Height)
        > > Dim rr As
        > > Integer=win32.S crollWindowEx(r ichTextBox1.Han dle,0,10,rtin,r t,IntPtr.Zero,r tout,0)
        > > System.Console. WriteLine(rr.To String())
        > > End Sub
        > >
        > > David Anton
        > > www.tangiblesoftwaresolutions.com
        > > Home of:
        > > Instant C#: VB.NET to C# Converter
        > > Instant VB: C# to VB.NET Converter
        > > Instant J#: VB.NET to J# Converter
        > >
        > > "Scott Gunn" wrote:
        > >[color=darkred]
        > >> 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
        > >> >Tony
        > >> >
        > >> >
        > >> >"Peter Huang [MSFT]" <v-phuang@online.m icrosoft.com> wrote in message
        > >> >news:VQ757BURD HA.1720@cpmsftn gxa09.phx.gbl.. .
        > >> >> Hi Tony,
        > >> >>
        > >> >> I consult the MSDN and find that the RECT structure required by the ?
        > >> >> °ScrollWindowE x¡± API is different from the class ¡°Rectangle¡ ±. I
        > >> >> think
        > >> >> you may declare your ¡°ScrollWindo wEx¡± API as follows.
        > >> >> public class win32
        > >> >> {
        > >> >> [DllImport("user 32.dll")]
        > >> >> public static extern int ScrollWindowEx(
        > >> >> IntPtr hWnd,
        > >> >> int dx,
        > >> >> int dy,
        > >> >> [MarshalAs(Unman agedType.Struct )] ref Rectangle prcScroll,
        > >> >> [MarshalAs(Unman agedType.Struct )] ref Rectangle prcClip,
        > >> >> IntPtr hrgnUpdate,
        > >> >> [MarshalAs(Unman agedType.Struct )] out Rectangle prcUpdate,
        > >> >> [MarshalAs(Unman agedType.U4)] int flags);
        > >> >>
        > >> >> }
        > >> >> Then you may invoke the API as below.
        > >> >> private void button1_Click(o bject sender, System.EventArg s e)
        > >> >> {
        > >> >> Rectangle rt = new Rectangle();
        > >> >> Rectangle rtout = new Rectangle(0,0,1 0,10);
        > >> >> Rectangle rtin = new
        > >> >> Rectangle(20,20 ,richTextBox1.W idth,richTextBo x1.He ight);
        > >> >> int rr=win32.Scroll WindowEx(richTe xtBox1.Handle,0 ,10,r ef rtin,ref
        > >> >> rt,IntPtr.Zero, out rtout,0);
        > >> >> System.Console. WriteLine(rr.To String());
        > >> >> }
        > >> >>
        > >> >> Hope this will help.
        > >> >>
        > >> >> Best regards,
        > >> >> Peter Huang
        > >> >>
        > >> >> Regards,
        > >> >>
        > >> >> Peter Huang
        > >> >> =============
        > >> >> This posting is provided "AS IS" with no warranties, and confers no
        > >> >rights.
        > >> >>
        > >> >> --------------------
        > >> >> >From: "Tony" <engineliu@hotm ail.com>
        > >> >> >Subject: Calling the ScrollWindowEx API
        > >> >> >Date: Fri, 4 Jul 2003 08:45:32 +0800
        > >> >> >Lines: 21
        > >> >> >X-Priority: 3
        > >> >> >X-MSMail-Priority: Normal
        > >> >> >X-Newsreader: Microsoft Outlook Express 6.00.3790.0
        > >> >> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
        > >> >> >Message-ID: <ee1WWWcQDHA.28 32@TK2MSFTNGP10 .phx.gbl>
        > >> >> >Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
        > >> >> >NNTP-Posting-Host: cm203-168-247-148.hkcable.com .hk 203.168.247.148
        > >> >> >Path: cpmsftngxa09.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTN GP10.phx.gbl
        > >> >> >Xref: cpmsftngxa09.ph x.gbl
        > >> microsoft.publi c.dotnet.langua ges.csharp:3051 9
        > >> >> >X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
        > >> >> >
        > >> >> >Hi, I am having problem to scroll only a partion of a window using
        > >> >> >the
        > >> >> >ScrollWindow Ex api function. The code is below and any help is
        > >> >> >pleased.
        > >> >> >Thanks in advance.
        > >> >> >
        > >> >> >
        > >> >> >[DllImport("user 32.dll")]
        > >> >> >private extern int ScrollWindowEx (IntPtr handle, int dx, int dy,
        > >> >Rectangle
        > >> >> >lprcScroll , Rectangle lprcClip, IntPtr hrgnUpdate, out Rectangle
        > >> >> >lprcUpdate, int fuScroll);
        > >> >> >
        > >> >> >Rectangle rt;
        > >> >> >
        > >> >> >// This works
        > >> >> >ScrollWindowEx (Handle, 0, 30, Rectangle.Empty , Rectangle.Empty ,
        > >> >> IntPtr.Zero,
        > >> >> >out rt, 0);
        > >> >> >
        > >> >> >// This doesn't work
        > >> >> >ScrollWindowEx (Handle, 0, 30, new Rectangle(20, 20, ClientSize.Widt h,
        > >> >> >ClientSize.Hei ght), Rectangle.Empty , IntPtr.Zero, out rt, 0);
        > >>
        > >> URL: http://www.pcreview.co.uk/forums/thread-1349023.php
        > >>
        > >> I have the same problem
        > >>
        > >> This works:
        > >> ScrollWindowEx( Handle, 0, 30, Rectangle.Empty , Rectangle.Empty ,
        > >> IntPtr.Zero,
        > >> Rectangle.Empty , 0)
        > >>
        > >> This doesn't work
        > >> ScrollWindowEx( Handle, 0, 30, new Rectangle(20, 20, ClientSize.Widt h,
        > >> ClientSize.Heig ht), Rectangle.Empty , IntPtr.Zero, rectangle.empty , 0)
        > >>
        > >> Many Thanks
        > >> Scott
        > >>
        > >>
        > >>[/color][/color]
        >
        >
        >[/color]

        Comment

        Working...