?
Solved

Delphi, NT service and running executable files

Posted on 2003-03-03
8
Medium Priority
?
434 Views
Last Modified: 2008-02-01
Hi everybody,

I have a correctly working service except one function that is vital for me. In a specific time service could run an executable file. I tried an TFileRun but although it works fine in normal windows application it didn't work fine in a service environment.

My question is It is possible to run an executable file from running NT service?

Thanks for any advice.
MiZ
0
Comment
Question by:MiZ
[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
8 Comments
 
LVL 15

Accepted Solution

by:
VGR earned 152 total points
ID: 8055800
have you tried this kind of function ?

Function ExecNewProcess(ProgramName : String; doWait : Boolean = False) : Boolean;
var
  StartInfo  : TStartupInfo;
  ProcInfo   : TProcessInformation;
  CreateOK   : Boolean;
begin

  { fill with known state }
  FillChar(StartInfo,SizeOf(TStartupInfo),#0);
  FillChar(ProcInfo,SizeOf(TProcessInformation),#0);
  StartInfo.cb := SizeOf(TStartupInfo);

  CreateOK := CreateProcess(nil, PChar(ProgramName), nil, nil,False,
              CREATE_NEW_PROCESS_GROUP+NORMAL_PRIORITY_CLASS,
              nil, nil, StartInfo, ProcInfo);

  { check to see if successful }
  if CreateOK then
    //may or may not be needed. Usually wait for child processes
    if doWait then WaitForSingleObject(ProcInfo.hProcess, INFINITE);
  ExecNewProcess:=CreateOK;
end;
0
 

Assisted Solution

by:pderuiter
pderuiter earned 148 total points
ID: 8055886
Or just use shellExecute, works for me :)
0
 

Author Comment

by:MiZ
ID: 8056198
I will try. Thank you.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Expert Comment

by:CleanupPing
ID: 9316976
MiZ:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 15

Expert Comment

by:VGR
ID: 9331697
split
0
 

Expert Comment

by:pderuiter
ID: 9334867
splpit
0
 
LVL 5

Expert Comment

by:snehanshu
ID: 9999622
Hi!
No comment has been added lately and this question is therefore classified abandoned.

If asker wishes to close the question, then refer to
http://www.experts-exchange.com/help/closing.jsp

Otherwise, I will leave a recommendation in the Cleanup topic area that this question is:

Split between VGR and pderuiter

Please leave any comments here within the next seven days. It is assumed that any participant not responding to this request is no longer interested in its final disposition.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

...Snehanshu
EE Cleanup Volunteer

P.S.
  VGR and pderuiter, don't you think the problem would have been that the service was not "interactive" so MiZ thought the exe is not being executed?
0
 
LVL 1

Expert Comment

by:Computer101
ID: 10029542
Forced accept

Computer101
E-E Admin
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

771 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