Home > Back-end >  Off external exe program in Delphi service program
Off external exe program in Delphi service program

Time:09-30

In his written by Delphi service program, if off external exe program? Also, in writing your own service program how to change the screen resolution? I in writing your own services, access to the machine's screen resolution, my resolution is 1366 x 768, but every time I get is 1024 x 768, I had a test, in the service process of a form in the create method, the output current of the screen resolution, the process carried out several times to create 1366 x 768 x 768 and 1024 all have output, don't know is what circumstance, ask everybody to help,

CodePudding user response:

Postmessage (handle, wm_syscommand, sc_close, 0).

CodePudding user response:

reference 1st floor zhzhrony response:
postmessage (handle, wm_syscommand, sc_close, 0).


Shut down or not will be outside of the program, is I use OpenProcess process ID

CodePudding user response:

Must find EXE handle, can control closed,

CodePudding user response:

reference lyhoo163 reply: 3/f
must find EXE handle, can control closed.

Could you tell me how can I get this exe handle?

CodePudding user response:

reference 1st floor zhzhrony response:
postmessage (handle, wm_syscommand, sc_close, 0).



Handle to the
=findwindow (nil, 'forms caption'); 
Postmessage (handle, wm_syscommand, sw_close, 0).

CodePudding user response:

reference 5 floor zhzhrony reply:
Quote: refer to 1st floor zhzhrony response:

Postmessage (handle, wm_syscommand, sc_close, 0).



 handle:=findwindow (nil, 'forms caption'); 
Postmessage (handle, wm_syscommand, sc_close, 0).


CodePudding user response:

refer to 6th floor zhzhrony response:
Quote: refer to the fifth floor zhzhrony reply:

Quote: refer to 1st floor zhzhrony response:

Postmessage (handle, wm_syscommand, sc_close, 0).



 handle:=findwindow (nil, 'forms caption'); 
Postmessage (handle, wm_syscommand, sc_close, 0).



This method in the ordinary course of the application as if can, but in the service application seems to return true not line,

CodePudding user response:

reference 5 floor zhzhrony reply:
 handle=findwindow (nil, 'forms caption'); 
Postmessage (handle, wm_syscommand, sw_close, 0).


I use findwindow in ordinary application, by clicking on the button, you can get I want to handle, but in the service process, no visual interface, the handle is always zero

CodePudding user response:

refer to the eighth floor class221 response:
Quote: refer to the fifth floor zhzhrony reply:

Handle to the
=findwindow (nil, 'forms caption'); 
Postmessage (handle, wm_syscommand, sw_close, 0).


I use findwindow in ordinary application, by clicking on the button, you can get I want to handle, but, in the service process, no visual interface, the handle is always 0


No forms caption can find the handle, but need to know the name of the class,

CodePudding user response:

Can't find the handle without the word of the visual interface, but should be able to find process, then close process

CodePudding user response:

references 9 f seleron response:
Quote: refer to the eighth floor class221 response:

Quote: refer to the fifth floor zhzhrony reply:

Handle to the
=findwindow (nil, 'forms caption'); 
Postmessage (handle, wm_syscommand, sw_close, 0).


I use findwindow in ordinary application, by clicking on the button, you can get I want to handle, but, in the service process, no visual interface, the handle is always 0


No forms caption can find the handle, but need to know the name of the class,


Not form the title, I mean my service program form, external exe program is a form, but I don't know why, is not the external exe handle, don't know what is in service program need permission?

CodePudding user response:

references 9 f seleron response:
Quote: refer to the eighth floor class221 response:

Quote: refer to the fifth floor zhzhrony reply:

Handle to the
=findwindow (nil, 'forms caption'); 
Postmessage (handle, wm_syscommand, sw_close, 0).


I use findwindow in ordinary application, by clicking on the button, you can get I want to handle, but, in the service process, no visual interface, the handle is always 0


No forms caption can find the handle, but need to know the name of the class,


Closing process can be achieved, but if the closing process directly, and I need to change the resolution of the screen, my external exe program is to change the screen resolution, startup change screen resolution to 800 x600, back will change screen resolution is turned off,

CodePudding user response:

refer to 12 floor class221 reply:
Quote: references 9 f seleron response:

Quote: refer to the eighth floor class221 response:

Quote: refer to the fifth floor zhzhrony reply:

Handle to the
=findwindow (nil, 'forms caption'); 
Postmessage (handle, wm_syscommand, sw_close, 0).


I use findwindow in ordinary application, by clicking on the button, you can get I want to handle, but, in the service process, no visual interface, the handle is always 0


No forms caption can find the handle, but need to know the name of the class,


Closing process can be achieved, but if the closing process directly, and I need to change the resolution of the screen, my external exe program is to change the screen resolution, startup change screen resolution to 800 x600, shut down after back will change the screen resolution,


1, since the external EXE is also you of, it is not simple, inside the EXE defines a unique type name, then via the service program;
2, external application starts to service program to send its own handle;

CodePudding user response:

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related