نمایش نتایج 1 تا 7 از 7

نام تاپیک: جاسازی فایل Avi در Exe ???????

  1. #1

    جاسازی فایل Avi در Exe ???????

    سلام
    فرض کنیم من می خواهم یک سی دی آموزشی بسازم
    حالا باید از فایلهای فیلم برداری شده حفاظت کنم
    برای اینکار چیکار می تونم بکنم
    دیدم که می شده فایل ای وی آی رو در Resource فایل Exe می گذارند
    اینکار رو هم خودم کردم ولی چه جوری پخشش کنیم
    آخه این پلیر دلفی فقط به فایل وصل می شه و نمیشه از Stream استفاده کرد
    اگر راه حل یا کامپوننت بهتری سراغ دارید متشکرم.


    مرسی ::نوشتن::

  2. #2
    کاربر دائمی آواتار Touska
    تاریخ عضویت
    مرداد 1383
    محل زندگی
    ایران زمین
    سن
    39
    پست
    1,988
    از Player های دیگر استفاده کنید.

    موفق باشید :flower:

  3. #3
    مثلا چی ؟

    ::نوشتن::

  4. #4
    راهنمائی بیشتری بفرمائید

  5. #5
    کاربر دائمی آواتار Touska
    تاریخ عضویت
    مرداد 1383
    محل زندگی
    ایران زمین
    سن
    39
    پست
    1,988
    با سلام ببین این بدرت می خوره از سایت Borland هست : :flower:

    Storing/Playing an .AVI file in a database - by Borland Developer Support Staff

    Rating: Rating is 1.5 - 2.5 Ratings: 4 Rate it

    Question and Answer Database

    FAQ1181D.txt Storing/Playing an .AVI file in a database
    Category :Database/VCL
    Platform :All
    Product :All 32 bit

    Question:
    How can I store an AVI file in a database and then play AVI
    files?

    Answer:
    AVI files can be stored in BLOB (binary large object) fields.
    The easiest way to play an AVI file stored in a BLOB is to write
    the BLOB data to a temporary file, then let the mulimedia player
    play the file. The following example demonstrates how to store
    an AVI file to a BLOB field, and also play the AVI file from the
    BLOB field.

    Example:

    var
    FileName : string;

    {This function gets a temporary file name form the system}
    function GetTemporaryFileName : string;
    {$IFNDEF WIN32}
    const MAX_PATH = 144;
    {$ENDIF}
    var
    {$IFDEF WIN32}
    lpPathBuffer : PChar;
    {$ENDIF}
    lpbuffer : PChar;
    begin
    {Get the file name buffer}
    GetMem(lpBuffer, MAX_PATH);
    {$IFDEF WIN32}
    {Get the temp path buffer}
    GetMem(lpPathBuffer, MAX_PATH);
    {Get the temp path}
    GetTempPath(MAX_PATH, lpPathBuffer);
    {Get the temp file name}
    GetTempFileName(lpPathBuffer,
    'tmp',
    0,
    lpBuffer);
    {Free the temp path buffer}
    FreeMem(lpPathBuffer, MAX_PATH);
    {$ELSE}
    {Get the temp file name}
    GetTempFileName(GetTempDrive('C'),
    'tmp',
    0,
    lpBuffer);
    {$ENDIF}
    {Create a pascal string containg}
    {the temp file name and return it}
    result := StrPas(lpBuffer);
    {Free the file name buffer}
    FreeMem(lpBuffer, MAX_PATH);
    end;

    {Read a AVI file into a blob field}
    procedure TForm1.Button1Click(Sender: TObject);
    var
    FileStream: TFileStream; {to load the avi file}
    BlobStream: TBlobStream; {to save to the blob}
    begin
    {Allow the button to repaint}
    Application.ProcessMessages;
    {Turn off the buttons}
    Button1.Enabled := false;
    Button2.Enabled := false;
    {Assign the avi file name to read}
    FileStream := TFileStream.Create(
    'C:\PROGRA~1\BORLAND\DELPHI~1\DEMOS\COOLSTUF\C OOL.AVI',
    fmOpenRead);
    Table1.Edit;
    {Create a BlobStream for the TField Table1AVI}
    BlobStream := TBlobStream.Create(Table1AVI, bmReadWrite);
    {Seek to the Beginning of the stream}
    BlobStream.Seek(0, soFromBeginning);
    {Delete any data that may be there}
    BlobStream.Truncate;
    {Copy from the FileStream to the BlobStream}
    BlobStream.CopyFrom(FileStream, FileStream.Size);
    {Free the streams}
    FileStream.Free;
    BlobStream.Free;
    {Post the record}
    Table1.Post;
    {Enable the buttons}
    Button1.Enabled := true;
    Button2.Enabled := true;
    end;

    {Read an avi stored in a blob, and play it}
    procedure TForm1.Button2Click(Sender: TObject);
    var
    FileStream: TFileStream; {a temp file}
    BlobStream: TBlobStream; {the AVI Blob}
    begin
    {Create a blob stream for the AVI blob}
    BlobStream := TBlobStream.Create(Table1AVI, bmRead);
    if BlobStream.Size = 0 then begin
    BlobStream.Free;
    Exit;
    end;
    {Close the media player}
    MediaPlayer1.Close;
    {Reset the file name}
    MediaPlayer1.FileName := '';
    {Refresh the play window}
    MediaPlayer1.Display := Panel1;
    Panel1.Refresh;
    {if we have a temp file then erase it}
    if FileName <> '' then
    DeleteFile(FileName);
    {Get a temp file name}
    FileName := GetTemporaryFileName;
    {Create a temp file stream}
    FileStream := TFileStream.Create(FileName,
    fmCreate or fmOpenWrite);
    {Copy the blob to the temp file}
    FileStream.CopyFrom(BlobStream, BlobStream.Size);
    {Free the streams}
    FileStream.Free;
    BlobStream.Free;
    {Setup the Media player to play the AVI file}
    MediaPlayer1.FileName := filename;
    MediaPlayer1.DeviceType := dtAviVideo;
    MediaPlayer1.Open;
    MediaPlayer1.Play;
    end;

    procedure TForm1.FormDestroy(Sender: TObject);
    begin
    {Unassign the temp file from the media player}
    MediaPlayer1.Close;
    MediaPlayer1.FileName := '';
    {Erase the temp file}
    if FileName <> '' then
    DeleteFile(FileName);
    end;

    7/16/98 4:31:28 PM


    موفق باشید :flower:

  6. #6
    کاربر دائمی آواتار Touska
    تاریخ عضویت
    مرداد 1383
    محل زندگی
    ایران زمین
    سن
    39
    پست
    1,988

    یا این ساخت Setup

    ببین آیا این یکی بدردت می خوره

    موفق باشید :flower:

  7. #7
    مرسی امتحان کنم و خبرش رو می دهم
    روش اول زیاد مطلوب نیست چون می تونه توسط فرد حرفه ای به سرقت بره
    ولی دومی رو امتحان می کنم

    مرسی

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •