CFtpServer::OnExecute Method  
 
virtual void OnExecute(
  UINT nClientId,  
  LPCTSTR lpszProgram,  
  DWORD dwExitCode  
);

A virtual method that is invoked after the client has successfully executed an external program on the server.

Parameters

nClientId
An unsigned integer which uniquely identifies the client session.
lpszProgram
A null-terminated string that specifies the name of the program that was executed. This is the registered program name, and not a full path to the executable and its command arguments.
dwExitCode
An unsigned integer that specifies the exit code that was returned by the program.

Return Value

None.

Remarks

The OnExecute event handler is invoked after the client has successfully executed an external program using the SITE EXEC command. To implement an event handler, the application should create a class derived from the CFtpServer class, and then override this method.

This event will only be generated if the client has the FTP_ACCESS_EXECUTE permission. Clients are not granted this permission by default, and must be explicitly permitted to execute external programs. If the client does have this permission, it can only execute specific programs that have been registered by the server application using the RegisterProgram method.

The GetProgramOutput method can be used to obtain the unfiltered output from the external command, while the GetProgramText method will return filtered output from the program that contains only printable text characters.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: csftsv12.lib
Unicode: Implemented as Unicode and ANSI versions

See Also