Delphi - Llamar a otro programa con un botón

 
Vista:

Llamar a otro programa con un botón

Publicado por REHome (4 intervenciones) el 08/06/2003 21:20:48
Necesito ayuda de una cosa, cuando pegó un botón en el form, quiciera saber cualles son los comando que al pulsar el botón se ejecute el bloc de notas de windows llamado notedpad.exe o algo así. gracias

http://residentevilhome.iespana.es
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Llamar a otro programa con un botón

Publicado por Diego Romero (636 intervenciones) el 08/06/2003 23:31:22
Agrega ShellApi a la uses de tu form:

ShellExecute(Handle,nil,PChar('notepad.exe'),'','',SW_SHOWMAXIMIZED);
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Llamar a otro programa con un botón

Publicado por REHome (4 intervenciones) el 09/06/2003 01:51:04
Puse el código exactamente el que me diste:

procedure TForm1.Button1Click(Sender: TObject);
begin
ShellExecute(Handle,nil,PChar('notepad.exe'),'','',SW_SHOWMAXIMIZED);
end;

y no funciona,
¿Puedes decirme con detalle el motivo o decirme exactamente como es?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Llamar a otro programa con un botón

Publicado por Diego Romero (636 intervenciones) el 09/06/2003 07:31:54
Sería muy útil que me dijeras primero cuál es el mensaje de error, de otro modo me es imposible.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Llamar a otro programa con un botón

Publicado por Carlos A Ramirez (1 intervención) el 18/06/2021 04:18:49
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/ LLAMAR PROGRAMA EXTERNO                 20140619
IF W_PGMGENERICO = 'SERVINETEXT' THEN BEGIN
    // T_string:= 'C:\@\SERVINETCOMPRY.exe' ;   // esto funciona
    T_string:= ExtractFilePath(Application.ExeName) + W_PGMCODE ;
    T_string:= char(34) +  T_string +  char(34);       // se requiere comillas DOBLES si existen espacios en el folder
    w_parametros :=  D.USUARIO + ' ' + D.PASSWORD ;    // PARAMETROS A PASAR USUARIO Y PASSWORD
    W_ERROR:= ShellExecute(Handle, 'open', PChar(T_string) , PChar(w_parametros )   , '', SW_SHOWNORMAL );
  // ShellExecute(Handle, 'print', PChar('c:\test\test.doc'), nil, nil, SW_SHOW);
   // LLAMAR_PROGRAMA_EXTERNO(T_string);
   result:=true;
{Here is a complete list of the possible return values of ShellExecute:
http://tekreaders.com/blog/2011/08/03/shellexecute-in-delphi-launch-external-applications/
 
0 = The operating system is out of memory or resources.
2 = The specified file was not found
3 = The specified path was not found.
5 = Windows 95 only: The operating system denied access to the specified file
8 = Windows 95 only: There was not enough memory to complete the operation.
10 = Wrong Windows version
11 = The .EXE file is invalid (non-Win32 .EXE or error in .EXE image)
12 = Application was designed for a different operating system
13 = Application was designed for MS-DOS 4.0
15 = Attempt to load a real-mode program
16 = Attempt to load a second instance of an application with non-readonly data segments.
19 = Attempt to load a compressed application file.
20 = Dynamic-link library (DLL) file failure.
26 = A sharing violation occurred.
27 = The filename association is incomplete or invalid.
28 = The DDE transaction could not be completed because the request timed out.
29 = The DDE transaction failed.
30 = The DDE transaction could not be completed because other DDE transactions were being processed.
31 = There is no application associated with the given filename extension.
32 = Windows 95 only: The specified dynamic-link library was not found.
}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar