Shellexecute usage

xiaoxiao2021-03-06  135

Title: ShellExecute usage of: Unknown Source: Network

First, you must reference the shellapi.Pas unit: uses shellapi; 1. Standard usage shellexecute function prototype and parameter meanings as follows: function shellexecute (hwnd: hwnd; operation, filename, parameters, directory: pchar; showcmd: integer: hinst; stdcall; ● HWND: Used to specify the parent window handle. When a function calling process occurs, it will be the parent window of the Windows message window. For example, it can be set to the application main window handle, that is, Application.Handle, or it can be set to the desktop window handle (obtained with the getDesktopWindow function). ● Operation: Used to specify the operation to be performed. The "Open" operation represents the program specified by the filename parameter, or opens the file or folder specified by the filename parameter; "Print" means that the file specified by the FileName parameter; "Explore" operation indicates that the browsing is specified by the filename parameter. folder. When the parameter is set to NIL, the execution default operation "Open" is executed. ● FILENAME: Used to specify the file name to be opened, the program file name to be executed, or the folder name to be browsed. ● Parameters: If the filename parameter is an executable, this parameter specifies the command line parameter, otherwise this parameter should be NIL or PCHAR (0). ● Directory: Used to specify the default directory. ● Showcmd: If the filename parameter is an executable program, this parameter specifies the initial display mode of the program window, otherwise this parameter should be set to 0. If the SHELLEXECUTE function call is successful, the return value is an instance handle of the executed program. If the return value is less than 32, an error occurs. The above is merely the standard usage of the shellexecute function, and the special usage of it will be described below. 2. Special usage If the filename parameter is set to "http:" protocol format, the function will open the default browser and link to the specified URL address. If multiple browsers are installed in the user machine, the function will determine which browser is activated according to the settings of the HTTP Protocol Handler in the Windows 9x / NT Registry. Format 1: http: // Website domain. Such as: shellexecute (Handle, 'Open', 'http://www.neu.edu.cn', nil, nil, sw_shownormal); format 2: http: // Website Domain Name / Web file name. Such as: shellexecute (Handle, 'Open', http: //; www.neu.edu.cn/default.htm' ,nil, nil, sw_shownormal); if the filename parameter is set to "Mailto:" protocol format, then The function will start the default mail client, such as Microsoft Outlook, or Netscape Messanger. If multiple mail clients are installed in the user machine, the function will determine which mail customer program will be activated according to the setting of the Mailto protocol handler in the Windows 9x / NT registry. Format 1: Mailto: such as: Shellexecute (Handle, 'Open', 'Mailto:', NIL, NIL, SW_SHOWNORMAL); Open the new mail window.

转载请注明原文地址:https://www.9cbs.com/read-127479.html

New Post(0)