Solved

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

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

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
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 …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

920 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