🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
7 messages
7 total messages Started by Paul Wed, 14 Nov 2007 04:39
How to keep a Process running after user logs off
#1032
Author: Paul
Date: Wed, 14 Nov 2007 04:39
21 lines
1260 bytes
Hi, 
I have googled for asnwers to this question. One way seems to be to use
CreateProcessWithLogon.

I have attempted this in the following sequence
LogonUser(..) 
CreateEnvironmentBlock(..)
GetUserProfileDirectory(..)
CreateProcessWithLogon(..)
CloseHandle(..) 's

This starts the process OK - Task Manager shows it belonging to the
alternate user. Logging off this session causes the process started as
the alternate user to close also.

Am I heading in the right direction ?
Any Missing steps ?
Other clues ?

thanks
Paul
Re: How to keep a Process running after user logs off
#1033
Author: Remy Lebeau (TeamB)
Date: Wed, 14 Nov 2007 17:51
11 lines
1173 bytes
"Paul" <paulm@xacom.com.au> wrote in message 
news:473a8a10$1@newsgroups.borland.com...

> Am I heading in the right direction ?

No.  To have a process running without a user logged in, you need to write a 
service application instead.


Gambit 
Re: How to keep a Process running after user logs off
#1036
Author: Paul
Date: Thu, 15 Nov 2007 05:10
42 lines
2038 bytes
Remy Lebeau (TeamB) wrote:

> 
> "Paul" <paulm@xacom.com.au> wrote in message
> news:473a8a10$1@newsgroups.borland.com...
> 
> > Am I heading in the right direction ?
> 
> No.  To have a process running without a user logged in, you need to
> write a service application instead.
> 

Having explored this some more it appears to be possible in Win XP at
least.

1. For example 
http://www.ifdef.com/support/kb_article.asp?article_id=Q0202041612&
indicates they have a solution? For a $6K product I hope the would!

2. I have a process (BCB6 Application) that simply logs to a file every
5 seconds.

User1 and User2 have sysadmin rights. If I use the Windows scheduler to
start this process at system start up as user1. I then log on as User2
- I can see the log entries incrementing. I then log off for a period
and then log back on as User2. The log does not contain any gaps which
seems to indicate that the process kept running while User 2 was logged
off.

The problem I have with this is that the process is not visible either
logging on as User1 or User2. I'm still working on this problem and any
help would be much appreciated.

thanks 
Paul






-- 
Re: How to keep a Process running after user logs off
#1037
Author: Leo Havmøller
Date: Thu, 15 Nov 2007 12:10
18 lines
1785 bytes
> 2. I have a process (BCB6 Application) that simply logs to a file every
> 5 seconds.
>
> User1 and User2 have sysadmin rights. If I use the Windows scheduler to
> start this process at system start up as user1.

I.e. it runs under the local system account, like a service application 
would.

> The problem I have with this is that the process is not visible either
> logging on as User1 or User2. I'm still working on this problem and any
> help would be much appreciated.

Desktop interation is documented for service applications.
You are still heading in the wrong direction. Write a service application 
instead and be done with it.

Leo Havm�ller. 
Re: How to keep a Process running after user logs off
#1039
Author: Bob Gonder
Date: Thu, 15 Nov 2007 15:31
9 lines
1492 bytes
Leo Havm�ller wrote:

>You are still heading in the wrong direction. Write a service application 
>instead and be done with it.

Then, if you need to be interactive, write another app that interfaces
with the service and the user.
When the user logs off, the interactive app will terminate but
the service continues.
Re: How to keep a Process running after user logs off
#1046
Author: Paul
Date: Thu, 15 Nov 2007 19:59
6 lines
1013 bytes
Thanks for all the suggestions to use a service. Already have that in
place. Have been directed to do the same with an Application :-(

thanks
Paul
-- 
Re: How to keep a Process running after user logs off
#1079
Author: Paul
Date: Tue, 20 Nov 2007 06:23
17 lines
1212 bytes
An interesting followup - at least to me :-)

Using psexec - part of pstools - psTest.exe is a Builder6 app with a
main form and nothing else.

Running on XP pro - One user loged on as administrator

psexec -i -d -s C:\Dev\LogOff\psTest.exe
psexec -i -d -s C:\Windows\notepad.exe

logoff
logon

Notepad survives - would be interesting to know how it does this?

cheers
Paul
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads