Solved

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

Posted on 1997-07-26
3
213 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
  • 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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