Solved

Running another application from within an app

Posted on 1998-11-19
3
138 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 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

12 Experts available now in Live!

Get 1:1 Help Now