ShellExecute (handle, the 'open', 'C: \ Documents and Settings \ \ Administrator \ \ METER reading the ADB, ADB. Exe', 'the ADB push D: \ \ METER. The METER reading DBF sdcard/XFDataBase DBF_Input', ' ', SW_SHOWNORMAL);
Write mean open C: \ Documents and Settings \ \ Administrator \ \ METER reading the ADB ADB. Exe, push and written to the ADB D: \ \ METER. The METER reading DBF sdcard/XFDataBase DBF_Input
?
Why can't compile, add shellapi USES
CodePudding user response:
Really no one, I wipeCodePudding user response:
Seek advice greatlyCodePudding user response:
unit Unit1;
Interface
USES the
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ShellAPI StdCtrls;
Type
TForm1=class (TForm)
For: TButton;
Procedure Button1Click (Sender: TObject);
Private
{Private declarations}
Public
{Public declarations}
The end;
Var
Form1: TForm1;
Implementation
{$R *. DFM}
Procedure TForm1. Button1Click (Sender: TObject);
The begin
ShellExecute (handle, the 'open', 'C: \ Documents and Settings \ \ Administrator \ \ METER reading the ADB, ADB. Exe', 'the ADB push D: \ \ METER. The METER reading DBF sdcard/XFDataBase DBF_Input', ' ', SW_SHOWNORMAL);
The end;
End.
I built a project, did the compiler allow, and see you this error message is you declare a form process, name is ShellExecute, it is illegal
CodePudding user response:
I just tried to: because I add the function in the type, I want to ask why some functions to add in the typeThe other is on the Internet I see inside the function file directory to add pchar, do not add to it
CodePudding user response:
, generally want to see the results, if it is normal and also, sometimes without will compile pass, or garbled words, this is because the Delphi character type (string) and Microsoft's C/VB inconsistent character types, plus mean is indicate the type conversion API is Microsoft products, Delphi just encapsulates.CodePudding user response:
The type is defined meaning, from the perspective of the code of my hair, from the type... To this end on var; Are defined within the form elements, such as for: TButton; Defines a name for the:, category is TButton; Variable, it belongs to TForm1 class, procedure Button1Click (Sender: TObject); Is the form of a process; If defined in this passage, do not belong to the form element, belongs to the global variables, such as var Form1: TForm1. Is a global variableCodePudding user response:
1, the String is Delphi String, in order to convert a Windows can identify String, should pass PChar () casting, so as to complete call specifying EXE, open the specified file,2, still have to join ShellAPI unit, because calling Windows API functions,
3, it is recommended that the following code, clear and understandable,
var FileNam sParam: string;
The begin
FileName:='C: \ Documents and Settings \ \ Administrator \ \ meter reading the ADB, ADB. Exe';
SParam:='adb push D: \ \ METER METER reading DBF sdcard/XFDataBase DBF_Input';
Shellexecute (handle, the 'open', pchar (FileName), pchar (sParam), nil, sw_shownormal);
The end;
CodePudding user response:
According to the practice of 7th floor still can only open the exe, but push the adb command don't go inCodePudding user response: