Ver Mensaje Individual
  #11  
Antiguo 24-02-2008
Avatar de ixMike
ixMike ixMike is offline
Miembro
 
Registrado: feb 2004
Posts: 1.151
Reputación: 24
ixMike Va por buen camino
Cita:
Empezado por Delphius Ver Mensaje
Y bueno ya que andamos... también podemos usar otra variante (aprovechando el Memo): abrir un archivo que contenga estos datos.

E incluso podemos eliminar el timer y aún asi hacer que cada 35 segundos se visite una página. ¿O no ixMike?

Saludos,

y también hacer un programa sin ventana, que lea de un archivo los datos, tanto las páginas como el tiempo de espera. Sería algo así: dos archivos, MiniUnidad.pas, y MuestraPaginas.dpr

Código Delphi [-]
unit MiniUnidad;

interface

//Para ahorrarnos Windows.pas
const
  SW_SHOWNORMAL = 1;

//Para ahorrarnos ShellApi.pas y Windows.pas
function ShellExecute(hWnd: Integer; Operation, FileName, Parameters,
  Directory: PChar; ShowCmd: Integer): Integer; stdcall;
procedure Sleep(dwMilliseconds: Integer); stdcall;

//Para ahorrarnos SysUtils.pas
function StrToInt(const S: String): Integer;

implementation

function ShellExecute; external 'shell32.dll' name 'ShellExecuteA';
procedure Sleep; external 'kernel32.dll' name 'Sleep';

function StrToInt(const S: String): Integer;
var n, r, m: integer;
begin
r:=0;
m:=1;
for n:=Length(S) downto 1 do
  begin
  Inc(r, (Ord(S[n])-48)*m);
  m:=m*10;
  end;
Result:=r;
end;

end.

Código Delphi [-]
program MuestraPaginas;

uses MiniUnidad;

var
  F: TextFile;  //Archivo de texto
  L: String;  //Página a abrir
  T: Integer; //Tiempo a esperar

begin
AssignFile(F, ParamStr(0)+'.txt'); //Abre el archivo MuestraPaginas.exe.txt
Reset(F);
ReadLn(F, L);
T:=StrToInt(L);
while not EOF(F) do
  begin
  ReadLn(F, L);
  ShellExecute(0, 'open', PChar(L), nil, nil, SW_SHOWNORMAL);
  Sleep(T);
  end;
CloseFile(F);
end.

No lo he comprobado, pero debería funcionar.


Salu2

Última edición por ixMike fecha: 24-02-2008 a las 19:38:11. Razón: corregir algunos fallos
Responder Con Cita