Solved

ScrollWindowEx

Posted on 1997-07-24
6
1,106 Views
Last Modified: 2010-07-27
Whats the EXACT syntax for using this win api call?
0
Comment
Question by:sz3905
  • 3
  • 3
6 Comments
 
LVL 4

Expert Comment

by:erajoj
ID: 1339736
The EXACT syntax is this:

  function ScrollWindowEx(
    hWnd      : HWND;    // handle of window to scroll
    dx,                  // amount of horizontal scrolling
    dy        : Integer; // amount of vertical scrolling
    prcScroll,           // address of scroll rectangle
    prcClip   : PRect;   // address of clip rectangle
    hrgnUpdate: HRGN;    // handle of update region
    prcUpdate : PRect;   // address of update rectangle
    flags     : UINT     // scrolling flags
  ): BOOL; stdcall;

Read the help for further info on the parameters.

And this is an example of how simple it is to use it:

  ScrollWindowEx(
    Handle,      // Handle of window to scroll
    10,              // Amount of horizontal scrolling
    10,              // Amount of vertical scrolling
    nil,      // Scroll whole window
    nil,        // No clipping necessary
    0,              // Don't need it
    nil,        // Don't need it
    SW_ERASE    // Erase background to clBtnFace in this case
   );

Hope this is what you asked for.

/// John

0
 

Author Comment

by:sz3905
ID: 1339737
John I'm sorry, I was looking for an exact useable syntax. More like a simple working example of a scrolling rectangle, but with the complete prect structure vars and declarations. The sample you gave is like the books(which never have a working sample).    thx for a reply/steve
0
 
LVL 4

Expert Comment

by:erajoj
ID: 1339738
Have you tried it?
My example works fine.
I never send examples unless I have tested them.
What didn't work or what do you miss?

/// John

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:sz3905
ID: 1339739
I'm sure your sample works, your suggestion "Read the help for further info on the parameters" is where I'm having the problem.
The help doesn't give a working "procedure" sample that addresses the exact syntax for coding "prcScroll, prcClip, prcUpdate, hrgnUpdate" and I dont want to use "nil". If this is still unclear please state whats not clear.
John, thanks for being so quick in you response./steve

0
 
LVL 4

Accepted Solution

by:
erajoj earned 120 total points
ID: 1339740
This will probably look crappy since Experts-Exchange uses
proportional fonts :-( but I think you'll get the idea:

procedure TfrmMain.Button4Click(Sender: TObject);
var
  ScrollRect, ClipRect, UpdateRect: TRect;
  RGN: HRGN;
begin
  ScrollRect := Rect(50, 50, 150, 150);
  ClipRect   := Rect(50, 50, 150, 150);

   //  __________
   // |          |
   // |          |
   // |          |
   // |          |
   // |          |
   // |          |
   // |__________|
   // ^
   // ClipRect & ScrollRect

  ScrollWindowEx(
    Handle,                // Handle of window to scroll
    10,                    // Amount of horizontal scrolling
    10,                    // Amount of vertical scrolling
    @ScrollRect,          // Scroll whole window
    @ClipRect,        // No clipping necessary
    RGN,                  // Region returned
    @UpdateRect,      // Region boundaries
    SW_SCROLLCHILDREN      // This will move the children affected!
   );

   //  __________
   // |##########|
   // |## _______|
   // |##|       |  ## = RGN;
   // |##|       |
   // |##|       |
   // |##|       |
   // |__|_______|
   // ^  ^
   // |  ScrollRect
   // ClipRect & UpdateRect (in this case)


  ScrollRect := Rect(50, 50, 150, 150);
  ClipRect   := Rect(50, 50, 150, 150);

   //  __________
   // |          |
   // |          |
   // |          |
   // |          |
   // |          |
   // |          |
   // |__________|
   // ^
   // ClipRect & ScrollRect

  ScrollWindowEx(
    Handle,                // Handle of window to scroll
    10,                    // Amount of horizontal scrolling
    0,                    // Amount of vertical scrolling
    @ScrollRect,          // Scroll whole window
    @ClipRect,        // No clipping necessary
    RGN,                  // Region returned
    @UpdateRect,      // Region boundaries
    SW_SCROLLCHILDREN      // This will move the children affected!
   );

   //  __________
   // |##|       |
   // |##|       |
   // |##|       |  ## = UpdateRect + RGN;
   // |##|       |
   // |##|       |
   // |##|       |
   // |__|_______|
   // ^  ^
   // |  ScrollRect
   // ClipRect

end;

Now then, or am I a really stupid person, not understanding
what you need to know?

/// John

0
 

Author Comment

by:sz3905
ID: 1339741
you said "Now then, or am I a really stupid person, not understanding what you need to know? "
---------------------------------
No John, you answered perfectly!
thx/steve
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi TcxGrid group footer summary 3 213
Convert Jpg /PNG To GIF 5 120
Delphi - replicating a form 8 67
tvirtualstringtree freeze when load too manny images 10 53
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now