Ver Mensaje Individual
  #1  
Antiguo 27-03-2011
JXJ JXJ is offline
Miembro
 
Registrado: abr 2005
Posts: 2.475
Reputación: 22
JXJ Va por buen camino
Question c++ Builder enviar parametros

hola en C++ Builder

¿como puedo pasar parametros ¡?

especialmente al enviar parametros con espacios

por ejemplo abrir archivo que esta en

C:\miapp.exe

tengo este codigo pero no se como hacerle

por que los parametros que la aplicacion recibe.

se muestran asi.

c:\miapp.exe
parametro
1
parametro
2
parametro
_3


y yo quiero que salgan asi.
c:\miapp.exe
parametro 1
parametro 2
parametro _3



Código:
 
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
     BOOL CreateProcess(
  LPCWSTR pszImageName,
  LPCWSTR pszCmdLine,
  LPSECURITY_ATTRIBUTES psaProcess,
  LPSECURITY_ATTRIBUTES psaThread,
  BOOL fInheritHandles,
  DWORD fdwCreate,
  LPVOID pvEnvironment,
  LPWSTR pszCurDir,
  LPSTARTUPINFOW psiStartInfo,
  LPPROCESS_INFORMATION pProcInfo
);

void __fastcall TForm1::Button1Click(TObject *Sender)
{
STARTUPINFO StartInfo;// name structure
PROCESS_INFORMATION ProcInfo; // name structure
memset(&ProcInfo, 0, sizeof(ProcInfo)); // Set up memory block
memset(&StartInfo, 0 , sizeof(StartInfo)); // Set up memory block
StartInfo.cb = sizeof(StartInfo); // Set structure size
 

     char *sCmdLin =  "C:\\miapp.exe   'parametro 1'   'parametro 2'    'parametro _3' " ;
  int res = CreateProcess(NULL, sCmdLin  , NULL, NULL, NULL, NULL, NULL, NULL, &StartInfo, &ProcInfo);

}
//---------------------------------------------------------------------------
ayuda no entiendo

gracias por su atencion.
Responder Con Cita