Recent

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

Packs

  • Sr. Member
  • ****
  • Posts: 425
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: 16520
  • 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: 5855
  • 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: 43
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 »

 

TinyPortal © 2005-2018