Play a flash movie stored in Access Database

DLL Edition of the F-IN-BOX
fferdinan
Posts: 3
Joined: Thu Jun 15, 2006 5:02 am

Play a flash movie stored in Access Database

Postby fferdinan » Thu Jun 15, 2006 5:05 am

The dll doesn't work when I try to load a swf from memory. The swf file is stored and recovered from Access Database, using DAO 3.8 and Visual Basic 6.0

This is code:

First Method:

Dim abAVI() As Byte
Dim Rs As DAO.Recordset
Dim lpData As Long
Dim FileSize as Long

hwndFlashPlayerControl = CreateWindowExA(0, WC_FLASH, "", WS_CHILD Or WS_VISIBLE, 0, 0, rc.Right, rc.Bottom, Me.hWnd, 0, 0, 0)


Set Rs = oDatabase.OpenRecordset("Select Video From Data Where Id = 1")

abAVI = Rs("Video")

fileSize = UBound(abAVI) + 1

lpData = VarPtr(abAVI(0))

FPCLoadMovieFromMemory.layer = 0
FPCLoadMovieFromMemory.lpData = lpData
FPCLoadMovieFromMemory.dwSize = fileSize

SendMessageA_LoadMovieFromMemory hwndFlashPlayerControl, FPCM_LOADMOVIEFROMMEMORY, 0, FPCLoadMovieFromMemory







Second Method:

Dim abAVI() As Byte
Dim Rs As DAO.Recordset
Dim lpData As Long
Dim FileSize as Long
Dim hMem As Long


hwndFlashPlayerControl = CreateWindowExA(0, WC_FLASH, "", WS_CHILD Or WS_VISIBLE, 0, 0, rc.Right, rc.Bottom, Me.hWnd, 0, 0, 0)

Set Rs = oDatabase.OpenRecordset("Select Video From Data Where Id = 1")

abAVI = Rs("Video")

fileSize = UBound(abAVI) + 1
hMem = GlobalAlloc(GMEM_MOVEABLE, fileSize)

lpData = GlobalLock(hMem)

CopyMemory ByVal lpData, abAVI(0), fileSize

FPCLoadMovieFromMemory.layer = 0
FPCLoadMovieFromMemory.lpData = lpData
FPCLoadMovieFromMemory.dwSize = fileSize

SendMessageA_LoadMovieFromMemory hwndFlashPlayerControl, FPCM_LOADMOVIEFROMMEMORY, 0, FPCLoadMovieFromMemory



Any method works, what is wrong?


Thanks in advance.

Note: Some obvious code has been omitted.

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Thu Jun 15, 2006 7:53 am

Thank you for your question.

Could you (for testing) save this swf file from the database on the disk and try to see it using Internet Explorer?
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

fferdinan
Posts: 3
Joined: Thu Jun 15, 2006 5:02 am

Play a flash movie stored in Access Database

Postby fferdinan » Thu Jun 15, 2006 5:36 pm

Yes I saved the file (stored in the Database) and the it works correctly using the internet explorer.

You can get the same database here.

http://www.caribika.com/Data.mdb

It has a table: Videos and the table has two fields Id and Data, the Data field is where the swf is stored in binary format.

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Re: Play a flash movie stored in Access Database

Postby Softanics » Thu Jun 15, 2006 6:48 pm

fferdinan wrote:You can get the same database here.

http://www.caribika.com/Data.mdb


I can't load this mdb into my MS Access 2003. I'm getting the error. Did you protect the mdb?
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Thu Jun 15, 2006 6:50 pm

Are you sure that this line

CopyMemory ByVal lpData, abAVI(0), fileSize


is correct?

I'm not a guru of VB6 :) but... could you save to file from the lpData array (not from abAVI! )?
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

fferdinan
Posts: 3
Joined: Thu Jun 15, 2006 5:02 am

Play a flash movie stored in Access Database

Postby fferdinan » Fri Jun 16, 2006 2:38 am

Yeah, the line is correct.

lpData is a pointer where I gonna copy the data from the array abAVI(0)

I tried this line too, but the dll doesn't work

CopyMemory ByVal lpData, VarPtr(abAVI(0)), fileSize


Description:
CopyMemory [Memory Pointer To Copy], [Memory Pointer From Copy], [Size]


But doesn't work


I think that the same job in C++ doesn't work either. (Using DAO and MS Access)

May be a bug in the dll?

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Re: Play a flash movie stored in Access Database

Postby Softanics » Fri Jun 16, 2006 7:49 am

How do you declare CopyMemory? This is a correct declaration:

Code: Select all

Private Declare Sub CopyMemory Lib "Kernel32" Alias "RtlMoveMemory" (ByVal Destination As Long, ByVal Source As Long, ByVal Length As Long)


fferdinan wrote:I think that the same job in C++ doesn't work either. (Using DAO and MS Access)

May be a bug in the dll?


Could you download demo EXEs and try it?

If you can send me compilable project and database file it would be great.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html


Return to “DLL Edition”

Who is online

Users browsing this forum: No registered users and 12 guests

cron