me salta una advertencia(generalmente nunca le doy importancia) :
compila y funciona perfecto en xp, pero...
[Warning] Project1.dpr(38): Suspicious typecast of String to PWideChar
el codigo estaba pensado para una version superior a delphi 7
pero yo le cambie algunas partes para adaptarlo al ide 7
y necesito que fucione sin errores
Código: Seleccionar todo
program Project1;
{source code from icode.org }
{$APPTYPE CONSOLE}
{$DEFINE CracksMan} //autor
uses
Windows,
ShellApi;
Procedure RestartWithParams();
Var
param : string;
begin
Writeln('tipear parametros y [Enter] para salir: ');
Writeln('necesita ayuda? '#13#10 +
'-a :mostrar "hola mundo" MessageBox.'#13#10 +
'-b :mostrar creditos. '#13#10 +
'-c :mostrar algun argumento '#13#10);
Readln(Param);
//IF (ShellExecute(0, nil, LPCWSTR(ParamStr(0)), LPCWSTR(Param), nil, SW_NORMAL) > 32) then
IF (ShellExecute(0, nil, pchar(ParamStr(0)), pchar(Param), nil, SW_NORMAL) > 32) then
Begin
Halt(0);
End Else Writeln('fallo para salir de Aplicacion.');
end;
Function Main(): integer;
Var
Arg : LPCWSTR;
Argc: integer;
Begin
Argc := ParamCount();
IF (Argc = ERROR) Then RestartWithParams();
For Result := 1 to Argc do
Begin
Arg := LPCWSTR(paramstr(Result));
// Arg := pwidechar(paramstr(Result));
{ }IF (lstrcmpi(pansichar(Arg),'-a') = 0) then
Begin
MessageBox(0, 'hola mundo', 'muy ofuscado', 0);
End
Else IF (lstrcmpi(pansichar(Arg),'-b') = 0) then
Begin
Writeln('Example by Cracksman at ic0de.org');
End
Else IF (lstrcmpi(pansichar(Arg),'-c') = 0) then
Begin
Writeln('Argumento: ', Arg);
End
Else Writeln('Unknown Param: ', Arg);
End;
Result := Argc;
End;
Begin
Main();
Writeln('press [Enter] to Exit');
Readln;
end.