Solved

ScrollWindowEx

Posted on 1997-07-24
6
1,096 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

746 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

11 Experts available now in Live!

Get 1:1 Help Now