Recent

Author Topic: how to make application running always like windows service  (Read 2484 times)

Packs

  • Sr. Member
  • ****
  • Posts: 448
how to make application running always like windows service
« on: January 13, 2025, 11:05:06 am »
how to make application running always like windows service .

I have gui application it should always running .

Thaddy

  • Hero Member
  • *****
  • Posts: 16538
  • Kallstadt seems a good place to evict Trump to.
Re: how to make application running always like windows service
« Reply #1 on: January 13, 2025, 11:14:02 am »
A GUI application should never run as a service. Don't be silly.
What you should do is decouple the logic from the user interface, put the logic in the service and write a GUI client that interacts with the service  in user space.

Services are independent of a GUI, everybody knows that. (Well, obviously almost everybody)
« Last Edit: January 13, 2025, 11:52:12 am by Thaddy »
But I am sure they don't want the Trumps back...

PascalDragon

  • Hero Member
  • *****
  • Posts: 5862
  • Compiler Developer
Re: how to make application running always like windows service
« Reply #2 on: January 13, 2025, 09:06:33 pm »
how to make application running always like windows service .

I have gui application it should always running .

Current Windows versions don't allow services access to the UI for security reasons. Best you split your application into a GUI-less backend that you can put into a service and a UI application that will communicate with the service through IPC.

DragoRosso

  • New Member
  • *
  • Posts: 46
Re: how to make application running always like windows service
« Reply #3 on: January 14, 2025, 12:19:23 am »
This link can help, how was made in the past and how is not possible anymore ...

https://learn.microsoft.com/en-us/windows/win32/services/interactive-services

Quote
Important

Services cannot directly interact with a user as of Windows Vista. Therefore, the techniques mentioned in the section titled Using an Interactive Service should not be used in new code.

EDIT: for joking, create a simple service, also empty, and at in the Start Event put this line

Code: [Select]
MessageBox(0, 'Hello', 'I am starting', MB_SERVICE_NOTIFICATION+MB_ICONINFORMATION+MB_OK);
After the service starting,  look at event viewer ... you will see the message in the log instead to a Desktop  :D
« Last Edit: January 14, 2025, 12:26:44 am by DragoRosso »

d2010

  • Jr. Member
  • **
  • Posts: 94
Re: how to make application running always like windows service
« Reply #4 on: February 13, 2025, 02:11:02 am »
Services cannot directly interact with a user as of Windows Vista. Therefore, the techniques mentioned in the section titled Using an Interactive Service should not be used in new code.
EDIT: for joking, create a simple service, also empty, and at in the Start Event put this line
Code: [Select]
MessageBox(0, 'Hello', 'I am starting', MB_SERVICE_NOTIFICATION+MB_ICONINFORMATION+MB_OK);After the service starting,  look at event viewer ... you will see the message in the log instead to a Desktop  :D

How to check OutPutEvent display on screen isInsideWin7 ?, he=this function do not display
message at EventLog, expected not in screen ?
Code: [Select]
Function OutPutEvent(mssg:shortstring):integer;
Begin  mssg:=concat(mssg,#00);
         MessageBox(0,@mssg[01],'Devcinfo.exe', MB_SERVICE_NOTIFICATION+MB_ICONINFORMATION+MB_OK);
      Result:=5100;
End;
« Last Edit: February 13, 2025, 02:25:28 am by d2010 »

dsiders

  • Hero Member
  • *****
  • Posts: 1348
Re: how to make application running always like windows service
« Reply #5 on: February 13, 2025, 03:23:29 am »
Services cannot directly interact with a user as of Windows Vista. Therefore, the techniques mentioned in the section titled Using an Interactive Service should not be used in new code.
EDIT: for joking, create a simple service, also empty, and at in the Start Event put this line
Code: [Select]
MessageBox(0, 'Hello', 'I am starting', MB_SERVICE_NOTIFICATION+MB_ICONINFORMATION+MB_OK);After the service starting,  look at event viewer ... you will see the message in the log instead to a Desktop  :D

How to check OutPutEvent display on screen isInsideWin7 ?, he=this function do not display
message at EventLog, expected not in screen ?
Code: [Select]
Function OutPutEvent(mssg:shortstring):integer;
Begin  mssg:=concat(mssg,#00);
         MessageBox(0,@mssg[01],'Devcinfo.exe', MB_SERVICE_NOTIFICATION+MB_ICONINFORMATION+MB_OK);
      Result:=5100;
End;

You do seem to enjoy your .gifs. I'll give you a hint. Since there is no way to stop the animation here... no one knows what you're trying to demonstrate.
Preview the next Lazarus documentation release at: https://dsiders.gitlab.io/lazdocsnext

 

TinyPortal © 2005-2018