Solved

Running another application from within an app

Posted on 1998-11-19
3
143 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
[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
  • 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

732 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