Недавно добавленные исходники

•  DeLiKaTeS Tetris (Тетрис)  3 669

•  TDictionary Custom Sort  5 800

•  Fast Watermark Sources  5 603

•  3D Designer  8 215

•  Sik Screen Capture  5 913

•  Patch Maker  6 388

•  Айболит (remote control)  6 378

•  ListBox Drag & Drop  5 237

•  Доска для игры Реверси  94 551

•  Графические эффекты  6 570

•  Рисование по маске  5 643

•  Перетаскивание изображений  4 759

•  Canvas Drawing  5 135

•  Рисование Луны  4 863

•  Поворот изображения  4 410

•  Рисование стержней  3 116

•  Paint on Shape  2 360

•  Генератор кроссвордов  3 228

•  Головоломка Paletto  2 551

•  Теорема Монжа об окружностях  3 328

•  Пазл Numbrix  2 200

•  Заборы и коммивояжеры  2 849

•  Игра HIP  1 820

•  Игра Go (Го)  1 740

•  Симулятор лифта  2 072

•  Программа укладки плитки  1 798

•  Генератор лабиринта  2 240

•  Проверка числового ввода  1 924

•  HEX View  2 225

•  Физический маятник  1 911

 
скрыть

  Форум  

Delphi FAQ - Часто задаваемые вопросы

| Базы данных | Графика и Игры | Интернет и Сети | Компоненты и Классы | Мультимедиа |
| ОС и Железо | Программа и Интерфейс | Рабочий стол | Синтаксис | Технологии | Файловая система |



Delphi Sources

Автоматическое заполнение HTML-форм в браузере



Оформил: DeeCo

{ To test this code put a TWebBrowser and A TButton component on the form }


 function FillForm(WebBrowser: TWebBrowser; FieldName: string; Value: string): Boolean;
  var
    i, j: Integer;
    FormItem: Variant;
  begin
    Result := False;
    //no form on document  
  if WebBrowser.OleObject.Document.all.tags('FORM').Length = 0 then
    begin
      Exit;
    end;
    //count forms on document  
  for I := 0 to WebBrowser.OleObject.Document.forms.Length - 1 do
    begin
      FormItem := WebBrowser.OleObject.Document.forms.Item(I);
      for j := 0 to FormItem.Length - 1 do
      begin
        try
          //when the fieldname is found, try to fill out  
        if FormItem.Item(j).Name = FieldName then
          begin
            FormItem.Item(j).Value := Value;
            Result := True;
          end;
        except
          Exit;
        end;
      end;
    end;
  end;


  //When the document is complete try to fill out the field homepage with the url  
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
    const pDisp: IDispatch; var URL: OleVariant);
  begin
    if FillForm(WebBrowser1, 'homepage', 'http://www.swissdelphicenter.ch') = False then
      ShowMessage('Error. Field not available or no Form found.');
 end;

 // Show the Webbrowser-Progress in Label1  
procedure TForm1.WebBrowser1ProgressChange(Sender: TObject; Progress, ProgressMax: Integer);
  begin
    if ProgressMax = 0 then
    begin
      label1.Caption := '';
      Exit;
    end;
    try
      if (Progress <> -1) and (Progress <= ProgressMax) then
        label1.Caption := IntToStr((Progress * 100) div ProgressMax) + '% loaded...'
      else
        label1.Caption := '';
    except
      on EDivByZero do Exit;
    end;
  end;


  //For example you can load the page /en/addtip.php to the TWebBrowser  
//When the document is Complete the form where you can put your homepage  
//address is filled out  
procedure TForm1.Button1Click(Sender: TObject);
  begin
    Webbrowser1.Navigate('http://www.swissdelphicenter.ch/en/addtip.php');
    // Show the Titel of the currently active Webpage in the titlebar  
  // Den Titel der aktuellen Webseite in der Titeleiste anzeigen  
  Caption := Webbrowser1.OleObject.Document.Title;
  end;




Похожие по теме исходники

Image to HTML

HTML Parser (парсер)

Delphi to HTML Converter

Image2Html

 

Txt to HTML

Конвертер Word - HTML

Mini HTML Editor

MSHTML Editor

 

HTML Test Creator

Примеры оформления DBGrid

Аудио Деформатор

Weather Info 2 (информация о погоде)

 

Оптимальное кодирование информации

Рисование математических формул

Информация о процессах




Copyright © 2004-2025 "Delphi Sources" by BrokenByte Software. Delphi World FAQ

Группа ВКонтакте