Solved

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

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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 will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

770 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