Solved

How do I gain Control when Win API call is running?

Posted on 1997-07-26
3
217 Views
Last Modified: 2010-04-04
The application has 2 Forms, The 1st form is a menu and text editor,etc., the Second form scrolls form1 memo's text using ScrollWindowEx in a "for loop". Using buttons on the form2 or any control on form2 will not break out of, or stop the "for loop". I'm trying to pause the loop, then adjust the ScrollWindowEx params and resume. The loop starts when the form is activated.

I'm still learning, please help.  
0
Comment
Question by:sz3905
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
erajoj earned 30 total points
ID: 1339942
Hi again Steve,
You could, for instance, use "Application.ProcessMessages"
inside the "for"-loop or...:

  procedure TSecondForm.BreakBtnClick(Sender: TObject);
  begin
    Discontinue := False;        // Break for loop
  end;
  ...
  ...
  ...
  procedure TSecondForm.ScrollFirstForm;
  { Tight loop, allowing processing of messages }
  begin
    Discontinue := False;          // Initially
    for Index := 0 to Whatever do begin
      ScrollSecondWindows;         // Lots and lots of scrolling
      Application.ProcessMessages; // Take care of buttons
      if Discontinue then Break;   // Exit for loop  
    end;
  end;

Or put the scrolling inside a "TTimer.OnTimer" event.

  procedure TSecondForm.BreakBtnClick(Sender: TObject);
  { Slow loop, processing of messages externally }
  begin
    ScrollTimer.Enabled := False;        // Stop scrolling
  end;
  ...
  ...
  ...
  procedure TSecondForm.ScrollTimerTimer(Sender: TObject);
  begin
    ScrollSecondWindows;         // Timed scrolling
  end;
 
Hope this helps!

/// John
0
 

Author Comment

by:sz3905
ID: 1339943
John, You truly are an expert!
Any Ideas where a novice can find an effective tutorial?
thx/steve/sbsullivan@ucdavis.edu
0
 
LVL 4

Expert Comment

by:erajoj
ID: 1339944
There are several books and lots and lots of examples on the Web.
A book is recommended (talk to your local retailer, probably a
better selection where you live).
I haven't found any tutorials on the Web, but send me your
address and I will provide you with what I have found and what
I will find in the near future.
john.johansson@era.ericsson.se

/// John

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

697 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