Uruchamianie programu z parametrami

0
procedure TForm1.Button1Click(Sender: TObject);


var
  naped : char;
  typ   : integer;
begin
  //wykonanie pętli dla wszystkich liter alfabetu
  for naped:='a' to 'z' do
    begin

      typ:=GetDriveType(PChar(naped+': -v'));
      //wyświetlenie informacji
      case typ of

        DRIVE_FIXED:      ShellExecute(GetDesktopWindow,'open',('C:\windows\System32\defrag.exe'),(PChar(naped)),nil,SW_SHOWNORMAL);
             end;
    end;
end;
 end.

mam oto taki kod. I chce żeby gdy znajdzie dysk twardy otwierał się program z parametrem wiersza poleceń: 'litera dysku -v' Wpisałem coś takiego i nie działa. Może mi ktos pomóc? Byłbym wdzięczny

/pinokio

0

Helpa czasami używasz?

HINSTANCE ShellExecute(

    HWND hwnd,	// handle to parent window
    LPCTSTR lpOperation,	// pointer to string that specifies operation to perform
    LPCTSTR lpFile,	// pointer to filename or folder name string
    LPCTSTR lpParameters,	// pointer to string that specifies executable-file parameters 
    LPCTSTR lpDirectory,	// pointer to string that specifies default directory
    INT nShowCmd 	// whether file is shown when opened
   );	
 

Parameters

hwnd
Specifies a parent window. This window receives any message boxes that an application produces. For example, an application may report an error by producing a message box.

lpOperation
Pointer to a null-terminated string that specifies the operation to perform. The following operation strings are valid:

lpFile
Pointer to a null-terminated string that specifies the file to open or print or the folder to open or explore. The function can open an executable file or a document file. The function can print a document file.

lpParameters
If lpFile specifies an executable file, lpParameters is a pointer to a null-terminated string that specifies parameters to be passed to the application.

lpDirectory
Pointer to a null-terminated string that specifies the default directory.

nShowCmd
If lpFile specifies an executable file, nShowCmd specifies how the application is to be shown when it is opened.

0

a możesz mi to przetłumaczyć?

0
pinokio napisał(a)

a możesz mi to przetłumaczyć?

;-( Dla mnie EOT

0
procedure TForm1.Button1Click(Sender: TObject);
var
  naped : char;
  typ   : integer;
begin
  for naped:='a' to 'z' do
    begin
      typ:=GetDriveType(PChar(naped+':\'));
      case typ of
        DRIVE_FIXED:     ShellExecute(GetDesktopWindow, 'open', ('C:\windows\System32\defrag.exe'), PAnsiChar(naped+':\ -v'), nil, SW_SHOWNORMAL);
      end;
    end;
end;

1 użytkowników online, w tym zalogowanych: 0, gości: 1