faqts : Computers : Programming : Languages : Delphi

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

5 of 11 people (45%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

Delphi: Webcam: LAN: Image: Share: How to share webcam images between computers in LAN? [TimerShot]

Apr 28th, 2005 03:06
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 28 April 2005 ---------------------------------

Delphi: Webcam: LAN: Image: Share: How to share webcam images between 
computers in LAN? [TimerShot]

---

Steps: Overview:

 1. -Run a program that periodically saves an image to a folder

 2. -Run a program that periodically loads an image from that folder

     REPEAT

      ShowImage( "your folder\your filename.your extension" )

     UNTIL FALSE

 3. Put this executable program in a shared directory
    in your LAN network, and run this from each
    of your computers in your network

---
---

Steps: Overview:

 1. -Run a program that periodically saves an image to a folder

     1. Download and install the Microsoft TimerShot program

http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx

 2. -Run a program that periodically loads an image from that folder

     1. Start Delphi

     2. Create a web application that loads a file
        and shows it in a browser window

        1. Create a new application

        2. Put a webbrowser component on the form

           1. Goto palette 'Internet'

           2. Click on the last icon on the right 'WebBrowser'

        3. Put an 'Open File' box on the form

           1. Goto palette 'Dialogs'

           2. Click on the first icon on the left 'OpenDialog'

           3. Fill in the (default) filename

              1. Goto the Object Inspector (press <F11>)

              2. Goto the field 'Filename'

              3. Fill in a default filename

                  e.g. for TimerShot you could use the default path:

                   c:\documents and settings\<your 
username>\MyDocuments\MyPictures\MyPic.jpg

                  e.g.

                   c:\documents and 
settings\administrator\MyDocuments\MyPictures\MyPic.jpg

        4. Possibly change the time interval of refresh

           1. Goto palette 'Standard'

           2. Click on the icon 'Edit'

           3. -Select tab 'Properties'

           4. -Change the field 'Text'
               to

                10000

               (for a picture refresh rate of 10000 milliseconds, or
                thus every 10 seconds)

        5. Put a timer on the form

           1. Goto palette 'System'

           2. Click on the first icon on the left 'Timer'

           3. -Select tab 'Events'

               1. Type the text

--- cut here: begin --------------------------------------------------

                   Timer1.Interval := StrToInt( Edit1.Text ); // set 
your time interval

                   WebBrowser1.Navigate( OpenDialog1.Filename ); // 
set your (Webcam) filename (from TimeShot)

--- cut here: end ----------------------------------------------------

         6. Load your filename the first time

            1. Double click on the form

            2. This will create a 'FormCreate' event

            3. Fill in the following text

--- cut here: begin --------------------------------------------------

                if OpenDialog1.Execute then begin
                 WebBrowser1.Navigate( OpenDialog1.Filename );
                end;

--- cut here: end ----------------------------------------------------

        7. That will give alltogether the following source code

--- cut here: begin --------------------------------------------------

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, 
Forms,
  Dialogs, StdCtrls, OleCtrls, SHDocVw, ExtCtrls;

type
  TForm1 = class(TForm)
    WebBrowser1: TWebBrowser;
    Timer1: TTimer;
    OpenDialog1: TOpenDialog;
    Edit1: TEdit;
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Timer1.Interval := StrToInt( Edit1.Text );
  WebBrowser1.Navigate( OpenDialog1.FileName );
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
 if OpenDialog1.Execute then begin
  WebBrowser1.Navigate( OpenDialog1.FileName );
 end;
end;

end.

--- cut here: end ----------------------------------------------------

        8. If you run this program, it will

           1. It will ask you to browse to the picture you want to
              show (browse thus to your WebCam picture, stored
              periodically by TimerShot)

                +--------------------+
                |                    |
                |    your filename   |
                |                    |
                +--------------------+



           2. It will then show this picture in the web browser
              window


                +--------------------+
                |                    |
                |                    |
                |                    |
                |    your image      |
                |                    |
                |                    |
                |                    |
                |                    |
                |                    |
                |                    |
                |                    |
                |                    |
                |                    |
                +--------------------+

           3. You can change the refresh rate in the
              edit box

                e.g. change it from 10000 to 20000 (milliseconds)

                 +----------------+
                 | 10000          |
                 +----------------+

        9. Put this executable program Delphi in a shared directory in
           your LAN network, and run this from each of your computers
           in your network

---
---

Internet: see also:

---

Webcam: LAN: Image: Share: Link: Can you give an overview of links?
http://www.faqts.com/knowledge_base/view.phtml/aid/35845/fid/519

----------------------------------------------------------------------