Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Internet
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Colaboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #4  
Antiguo 04-04-2006
lpkwebagent007 lpkwebagent007 is offline
Registrado
 
Registrado: abr 2006
Posts: 7
Poder: 0
lpkwebagent007 Va por buen camino
Ping!
he encontrado el código,...pero no me funciona (ya mas o menos voy teniendo idea)
Código Delphi [-]
// Example: fill out 3 fields on a webpage. 
// If a field is found, continue to the next field; 
// else show an error message.
procedure TForm1.Button1Click(Sender: TObject);
begin
  if not FillForm(WebBrowser1, 'login', 'jaimito') then
    ShowMessage('Error: field LOGIN not found on page')
  else begin
    if not FillForm(WebBrowser1, 'password', 'soytupassword') then
      ShowMessage('Error: field PASSWORD not found on page')
    else begin
      if not FillForm(WebBrowser1, 'paja', 'activated') then
        ShowMessage('Error: field PAJA not done!');
    end;
  end; 
end; 

//Esto no entiendo
// Fill out the first field with the name "FieldName" with a value. 
// We assume that all the fields of the form(s) have different names.
function TForm1.FillForm(WB: TWebBrowser; FieldName, Value: string): Boolean;  
var  
  FormNr, ItemNr: integer;  
  TheForm: Variant;  
begin  
  Result := False;  
  // Check if there is at least one form in the document  
  if WB.OleObject.Document.All.Tags('FORM').Length = 0 then begin  
    ShowMessage('Error: no FORM found on page');
    Exit;  
  end;  
  // Process all forms of the document  
  for FormNr := 0 to WB.OleObject.Document.Forms.Length - 1 do begin  
    TheForm := WB.OleObject.Document.Forms.Item(FormNr); 
    // Process all forms of the document, stop if found  
    for ItemNr := 0 to WB.OleObject.Document.Forms.Item.length - 1 do
      try  
        // If the fieldname is found, try to fill out and stop  
        if TheForm.Item(ItemNr).Name = FieldName then begin  
          TheForm.Item(ItemNr).Value := Value;  
          Result := True;
        end;  
      except  
        Break;  
      end;
      if Result then Break; 
    end;
    // Remove next line if there are several forms in the document with the
    // same fieldnames an which should be set to the same value
    if Result then Break;
  end;  
end;

y sin embargo, compilando me salen chorrocientos de errores

[Error] Unit1.pas(28): E2003 Undeclared identifier: 'FillForm'
[Error] Unit1.pas(33): E2003 Undeclared identifier: 'Result'
[Error] Unit1.pas(35): E2003 Undeclared identifier: 'WB'
[Error] Unit1.pas(40): E2029 'DO' expected but identifier 'OleObject' found
[Error] Unit1.pas(41): E2066 Missing operator or semicolon
[Error] Unit1.pas(41): E2066 Missing operator or semicolon
[Error] Unit1.pas(43): E2029 'DO' expected but identifier 'OleObject' found
[Error] Unit1.pas(46): E2003 Undeclared identifier: 'FieldName'
[Error] Unit1.pas(47): E2003 Undeclared identifier: 'Value'
[Error] Unit1.pas(57): E2097 BREAK or CONTINUE outside of loop
[Error] Unit1.pas(59): E2029 '.' expected but ';' found
[Error] Unit1.pas(66): E2003 Undeclared identifier: 'FillForm'
[Fatal Error] Project1.dpr(5): F2063 Could not compile used unit 'Unit1.pas'

(no....no tengo ni p*ta idea de Delphi, estoy en pañales )

Última edición por lpkwebagent007 fecha: 04-04-2006 a las 02:15:04.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Ayuda En Login Y Pass Para Ingresar En un programa creado en Delphi Solojuegospc.tk Conexión con bases de datos 8 07-07-2005 03:18:28
Login y Logout douguiehm Varios 5 10-12-2004 19:46:36
Duda con WebBrowser hermes_32 Internet 6 24-05-2004 18:45:57
Suprimir Login InterBase jsc Conexión con bases de datos 4 29-01-2004 02:46:51
Formulario de login no funciona!! ElCherchu Varios 4 09-10-2003 15:54:51


La franja horaria es GMT +2. Ahora son las 00:51:09.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi