[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Controlling another ap with SendKeys

Posted on 2002-05-03
6
Medium Priority
?
212 Views
Last Modified: 2008-03-03
Hi

I am trying to control Adobe Acrobat from Delphi to automate a lengthy process.  I am sending keystrokes to Acrobat to control it. Everything works fine until there is an error.  

I have been using FindWindowEX to find out when a progress dialog window closes, thus signifying that it has finished its process, but if there is an error the progress dialog does not come up - just an error messagebox.  Both the progress dialog and the error messagebox have the same window title text.

Is there any way to tell whether Acrobat has thrown an error, or is just processing the files?  

If there is an error the error messagebox eventually closes because of a #13 keystroke sent to Acrobat in its normal stream of keystrokes, but the rest of the processing on the file does not take place, and Acrobat eventually runs out of resources because the individual files which produce errors are not closing when they should.

John
0
Comment
Question by:jdthedj
[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
  • 3
  • 2
6 Comments
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 6989406
perhaps you can also check the caption of the static text (i.e. the content of the dialog box)?
0
 
LVL 3

Author Comment

by:jdthedj
ID: 6989471
Hi DragonSlayer - thanks for the reply.  How do I do that?

John
0
 
LVL 8

Expert Comment

by:Cesario
ID: 6989496
With EnumChildWindows.
you can check the name of the first Control in your dialogbox

somthing like:

Function EnumProc ( H:THandle;Par:Word):Boolean; StdCall;
VAR
  ca:Array[1..250] of char;
Begin
  GetClassName(H,@Ca,SizeOf(ca));
  showMessage(ca);                   // this is the name of the control
  result := False;
End;

Procedure Tform1.xxxx;
Begin
   // get the handle of the dialogbox

   enumChildWindows ( TheDialogBox Handle,@EnumProc,0);
End;

Best Regards

Cesario

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Author Comment

by:jdthedj
ID: 6989583
Hi Cesario - thanks for the code.  

Just one problem - the EnumChildWindows call will not accept the 0 parameter at the end - it wants a variable.  What do I need to use for that?

John
0
 
LVL 8

Accepted Solution

by:
Cesario earned 200 total points
ID: 6989623
If have no Problems with this Function.

EnumChildWindows need three Parameters:
  1. The Handle of your Dialog
  2. EnumProc Function
  3. is an Integer

for more Information look into your Online Help


Function EnumProc ( H:THandle;Par:Word):Boolean; StdCall;
VAR
 ca:Array[1..250] of char;
Begin
 GetClassName(H,@Ca,SizeOf(ca));
 showMessage(ca);                   // this is the name of the control
 result := False;
End;

Procedure Tform1.Button1Click(Sender:TObject);
VAR
  hDlg : THandle;
Begin
  hDlg := FindWindow (....................);
  IF hDlg>0 Then
  Begin
    enumChildWindows ( hdlg,@EnumProc,0);
  End;
End;
0
 
LVL 3

Author Comment

by:jdthedj
ID: 6990092
Thanks Cesario - I've got it working.

John
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

649 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