Solved

Running another application from within an app

Posted on 1998-11-19
3
140 Views
Last Modified: 2010-04-04
I have a large application which requires a custom written print engine to be running in the background. Occasionally I have found users closing down this print engine, thus stopping any more printing being done.

Can anyone suggest a way of first checking if the print engine is running or not. One restriction I have is that I cannot access the source code of the print engine so the answer must come from modifications to my program.

Thank you for any assistance
0
Comment
Question by:psykes
  • 2
3 Comments
 
LVL 1

Expert Comment

by:sassas081597
ID: 1347302
Has your print engine any main window? In this case you can check whether the Window with specified name exists?
0
 

Author Comment

by:psykes
ID: 1347303
The print engine has a main window and will always be called by the same string, therefore I could try the method you described, except how do I check whether the specified name exists
0
 
LVL 1

Accepted Solution

by:
sassas081597 earned 100 total points
ID: 1347304
Use the function FindWindow (or FindWindowA, or FindWindowW) as shown bellow.
In this Example you write any text in EditBox and when you click a button the programm looks for a Window with the Caption exactly as in Editbox. If you get 0 - Such window does not exist else - it exists.

procedure TForm1.Button1Click(Sender: TObject);
var
    c: array[0..50] of Char;
    d: PChar;
begin
     StrPCopy(c,Edit1.Text);
     d:=nil;
     a:=;
     if (FindWindowA(d,c)<>0) then
          Caption:='Window Found'
     else
         Caption:='Window Not Found';
end;
So try this code and then write your own.
If you'd like, you can use FindWindowEx() instead of FindWindow() (look in windows.pas for its parameters).
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Newbie Thread Programming 1 155
select query - oracle 16 100
Delphi Yen format 3 35
How to load 2 images in same column in Delphi 2 47
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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

832 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