English
Forum

Program finish as a last?

 
Hello Profaner...

gives it a Possibility one Program at Shutdown the Rechners finish as a last To let?
 
05/19/05  
 



Dou you mean - The Order to determine - in the Kernel whom Prozessen The kill.app.message sends?

or mean You such a thing How instead of Autostart Autoend?

From beidem know I do not How - would for me but nevertheless interestingly what very you mean.

salvo.
 
05/19/05  
 



understand The question not so integrally, with ~WM_QUERYENDSESSION in a Callback, kannste intercepting whether Windows finishes becomes. You yourself as a last, not more than as service or Skript on NT-Systemen. I faith but the meets it not yet, or ???
 
05/19/05  
 



~WM_QUERYENDSESSION  is neither the golden of egg - there one in NT-Systemen a QUERYENDSESSIONTimeout of 0 take on can. means sure is such Callback neither umbedingt - even if almost no pig whom QUERYENDSESSIONTimeout of 20.000 on 0 (ms) setting.

I however habs done.

salvo.
 
05/19/05  
 



[quote:0ca25bf230=iF]Dou you mean - The Order to determine - in the Kernel whom Prozessen The kill.app.message sends?
[/quote:0ca25bf230]
Hello IF...

Yes, very. the depends u.a. from the Startreihenfolge the processes ex. I go time integrally heavy of it from, that the none or only with ploy goes.

@Thomas...
[quote:0ca25bf230]
understand The question not so integrally, with ~WM_QUERYENDSESSION in a Callback, kannste intercepting whether Windows finishes becomes.
[/quote:0ca25bf230]
in the moment regelt the the program over one Subclassing of ~WM_QUERYENDSESSION by a second EXE, The alone only for the Subclassing zuständig is. I wanted to time look, whether there yet any others Opportunities gives, as the Shutdown abzufangen.
[quote:0ca25bf230]
You yourself as a last, not more than as service or Skript on NT-Systemen. I faith but the meets it not yet, or ???
[/quote:0ca25bf230]
very circa NT-systems goes it. at that Shutdown the Systems becomes Yes on each Program The ~WM_QUERYENDSESSION gesendet.
the Program should absolutely as long as walk, How windows runs, this is important!
If I it somehow achieve could, that the Prog NT first as letztes The ~WM_QUERYENDSESSION sustain, could I me the Subclassing save and some would something sauberer go through...
 
05/19/05  
 




Michael
Wodrich
Hello Andreas,

me smears from and on the computer ex (with Prozessen ornate) and there's me noticed:

The FireFox is the last, the itself dismisses, I always several Tabs open have. FireFox asks now, whether it really terminate should. If I The question on-screen let, then is except the fox nothing more active.

In Profan there still SetCloseMsg, Maybe helps the Yes.

MfG
Michael Wodrich
 
Programmieren, das spannendste Detektivspiel der Welt.
05/19/05  
 



Hello Michael...

SetCloseMsg falls anyhow levelly, I to Time XProfan own.
FireFox might the over the Subclassing of ~WM_QUERYENDSESSION regulate - the would like I do not, I in my Program then To plenty self regulate should.
 
05/20/05  
 



Hello Thomas...

[quote:e3a546d485]
You yourself as a last, not more than as service or Skript on NT-Systemen. I faith but the meets it not yet, or ???
[/quote:e3a546d485]
possible meets it the still. under windows9x would very the The Solution (RegisterServiceProcess), there need I But not. One further trouble would, the my service one Window had. I could me present, the NT there evtl. with the Zugriffsrechten something streikt - there should I Perhaps still one little tricksen...
unfortunately have I none blassen Schimmer, How I NT a service installiere. can you - or otherwise someone - me Perhaps on The Sprünge help?
 
05/20/05  
 



[quote:6298a5d2c1=AH]
unfortunately have I none blassen Schimmer, How I NT a service installiere. can you - or otherwise someone - me Perhaps on The Sprünge help?[/quote:6298a5d2c1]
Have you what from the CodeArchiv for PureBasic rausgesucht. can it you first standing, Perhaps too yourself transfer, otherwise meldest you again. isn't heavy (for me is XProfan schwerer )
CompileMarkSeparation
; English forum:
; Author: Richard Eikeland
; Date: 12. April 2003
; angepaßt an 3.93 ts-soft
; Apr. 12, 2003
; Converted to PB by Richard Eikeland
; This code is posted as is with out any waranties.
;
#SERVICE_WIN32_OWN_PROCESS = $10
#SERVICE_WIN32_SHARE_PROCESS = $20
#SERVICE_WIN32 = #SERVICE_WIN32_OWN_PROCESS + #SERVICE_WIN32_SHARE_PROCESS
#SERVICE_ACCEPT_STOP = $1
#SERVICE_ACCEPT_PAUSE_CONTINUE = $2
#SERVICE_ACCEPT_SHUTDOWN = $4
#SC_MANAGER_CONNECT = $1
#SC_MANAGER_CREATE_SERVICE = $2
#SC_MANAGER_ENUMERATE_SERVICE = $4
#SC_MANAGER_LOCK = $8
#SC_MANAGER_QUERY_LOCK_STATUS = $10
#SC_MANAGER_MODIFY_BOOT_CONFIG = $20
#STANDARD_RIGHTS_REQUIRED = $F0000
#SERVICE_QUERY_CONFIG = $1
#SERVICE_CHANGE_CONFIG = $2
#SERVICE_QUERY_STATUS = $4
#SERVICE_ENUMERATE_DEPENDENTS = $8
#SERVICE_START = $10
#SERVICE_STOP = $20
#SERVICE_PAUSE_CONTINUE = $40
#SERVICE_INTERROGATE = $80
#SERVICE_USER_DEFINED_CONTROL = $100
;#SERVICE_ALL_ACCESS = #STANDARD_RIGHTS_REQUIRED | #SERVICE_QUERY_CONFIG | #SERVICE_CHANGE_CONFIG | #SERVICE_QUERY_STATUS | #SERVICE_ENUMERATE_DEPENDENTS | #SERVICE_START | #SERVICE_STOP | #SERVICE_PAUSE_CONTINUE | #SERVICE_INTERROGATE |#SERVICE_USER_DEFINED_CONTROL
#SERVICE_DEMAND_START = $3
#SERVICE_ERROR_NORMAL = $1
;- SERVICE_CONTROL
#SERVICE_CONTROL_STOP = $1
#SERVICE_CONTROL_PAUSE = $2
#SERVICE_CONTROL_CONTINUE = $3
#SERVICE_CONTROL_INTERROGATE = $4
#SERVICE_CONTROL_SHUTDOWN = $5
;-SERVICE_STATE
#SERVICE_STOPPED = $1
#SERVICE_START_PENDING = $2
#SERVICE_STOP_PENDING = $3
#SERVICE_RUNNING = $4
#SERVICE_CONTINUE_PENDING = $5
#SERVICE_PAUSE_PENDING = $6
#SERVICE_PAUSED = $7
Global ServiceStatus.SERVICE_STATUS, hServiceStatus.l, SERVICE_NAME.s, Finish.l
Declare Handler(fdwControl.l)
Declare ServiceMain(dwArgc.l, lpszArgv.l)
Declare WriteLog(Value.s)
Procedure Main()
hSCManager.l
hService.l
ServiceTableEntry.SERVICE_TABLE_ENTRY
b.l
cmd.s
;Change SERVICE_NAME and app name as needed
AppPath.s = "C:DevPureBasicworkdirNTServiceMyService.exe"
SERVICE_NAME = "MyService"
cmd = Trim(LCase(ProgramParameter()))

Select cmd

    Case "install" ;Install service on machine
    hSCManager = OpenSCManager_(0, 0, #SC_MANAGER_CREATE_SERVICE)
    hService = CreateService_(hSCManager, SERVICE_NAME, SERVICE_NAME, #SERVICE_ALL_ACCESS, #SERVICE_WIN32_OWN_PROCESS, #SERVICE_DEMAND_START, #SERVICE_ERROR_NORMAL, AppPath, 0, 0, 0, 0, 0)
    CloseServiceHandle_(hService)
    CloseServiceHandle_(hSCManager)
    Finish = 1
    Case "uninstall" ;Remove service from machine
    hSCManager = OpenSCManager_(0, 0, #SC_MANAGER_CREATE_SERVICE)
    hService = OpenService_(hSCManager, SERVICE_NAME, #SERVICE_ALL_ACCESS)
    DeleteService_(hService)
    CloseServiceHandle_(hService)
    CloseServiceHandle_(hSCManager)
    Finish = 1
    Default
    *sname.s = SERVICE_NAME
    ;Start the service
    ServiceTableEntrylpServiceName = @SERVICE_NAME
    ServiceTableEntrylpServiceProc = @ServiceMain()
    b = StartServiceCtrlDispatcher_(@ServiceTableEntry)
    WriteLog("Starting Service bResult=" + Str(b))

    If b = 0

        Finish = 1

    EndIf

EndSelect

Repeat

Until Finish =1

End
EndProcedure
Procedure Handler(fdwControl.l)
b.l

Select fdwControl

    Case #SERVICE_CONTROL_PAUSE
    ;** Do whatever it takes To pause here.
    ServiceStatusdwCurrentState = #SERVICE_PAUSED
    Case #SERVICE_CONTROL_CONTINUE
    ;** Do whatever it takes To continue here.
    ServiceStatusdwCurrentState = #SERVICE_RUNNING
    Case #SERVICE_CONTROL_STOP
    ServiceStatusdwWin32ExitCode = 0
    ServiceStatusdwCurrentState = #SERVICE_STOP_PENDING
    ServiceStatusdwCheckPoint = 0
    ServiceStatusdwWaitHint = 0 ;Might want a time estimate
    b = SetServiceStatus_(hServiceStatus, ServiceStatus)
    ;** Do whatever it takes to stop here.
    Finish = 1
    ServiceStatusdwCurrentState = #SERVICE_STOPPED
    Case #SERVICE_CONTROL_INTERROGATE
    ;Fall through To send current status.
    Finish = 1
    ;Else

EndSelect

;Send current status.
b = SetServiceStatus_(hServiceStatus, ServiceStatus)
EndProcedure
Procedure ServiceMain(dwArgc.l, lpszArgv.l)
b.l
WriteLog("ServiceMain")
;Set initial state
ServiceStatusdwServiceType = #SERVICE_WIN32_OWN_PROCESS
ServiceStatusdwCurrentState = #SERVICE_START_PENDING
ServiceStatusdwControlsAccepted = #SERVICE_ACCEPT_STOP | #SERVICE_ACCEPT_PAUSE_CONTINUE | #SERVICE_ACCEPT_SHUTDOWN
ServiceStatusdwWin32ExitCode = 0
ServiceStatusdwServiceSpecificExitCode = 0
ServiceStatusdwCheckPoint = 0
ServiceStatusdwWaitHint = 0
hServiceStatus = RegisterServiceCtrlHandler_(SERVICE_NAME, @Handler())
ServiceStatusdwCurrentState = #SERVICE_START_PENDING
b = SetServiceStatus_(hServiceStatus, ServiceStatus)
;** Do Initialization Here
ServiceStatusdwCurrentState = #SERVICE_RUNNING
b = SetServiceStatus_(hServiceStatus, ServiceStatus)
;** Perform tasks -- If none exit
;** If an error occurs the following should be used for shutting
;** down:
; SetServerStatus SERVICE_STOP_PENDING
; Clean up
; SetServerStatus SERVICE_STOPPED
EndProcedure
Procedure WriteLog(Value.s)
sfile.s = "MyServiceLog.txt"

If OpenFile(0, sfile)

    WriteStringN(Value)
    CloseFile(0)

Else

    If CreateFile(0,sfile)

        WriteStringN(Value)
        CloseFile(0)

    EndIf

EndIf

EndProcedure
Main()

white now mere not what the HL with the code power

Greeting
thomas
(ts-soft)
 
05/20/05  
 



The code becomes nothing benefit - there wirken only PureBasic-command for PureBasic-Compiler - and the compiliert Yes native.

In C++ z.B. ists eigendlich too only a Projekteinstellung - circa as service To compilieren.

salvo.
 
05/20/05  
 



*.l are long
*.s are string
*.b are byte
*Hello hierbei deals it itself circa strukturen

#xxxx are konstanten

functions with _ end are Api-functions

Greeting
Thomas

 
05/20/05  
 



[quote:676b84de14=iF]The code becomes nothing benefit - there wirken only PureBasic-command for PureBasic-Compiler - and the compiliert Yes native.

In C++ z.B. ists eigendlich too only a Projekteinstellung - circa as service To compilieren.

salvo.[/quote:676b84de14]there liegste something wrong, think I, only API Call with gefüllten Structures, as well as auswertung the übergebenen Commandos. ought to machbar his. the Program becomes only as service registered and reacted correspond to. If AH itself the respected has, and means it could so weg, I will it to XProfan umsetzen, hope I

Greeting
Thomas
 
05/20/05  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

3.929 Views

Untitledvor 0 min.
H.Brill11/18/23
W.L.07/05/17

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie