LoadMovieFromMemory did not work with vb..

DLL Edition of the F-IN-BOX
mobildev
Posts: 9
Joined: Mon Sep 04, 2006 7:29 am

LoadMovieFromMemory did not work with vb..

Postby mobildev » Mon Sep 04, 2006 7:37 am

Hi I wrote these lines in vb and don't work..I want to load movie from memory..(I do not want to use resource files. I read bytes from a file and use that byte array.. functions are below.)

Const WM_USER As Long = &H400
Const FPCM_FIRST As Long = WM_USER + &H1000
Const FPCM_PUTMOVIEFROMMEMORY As Long = FPCM_FIRST + 2
Private Type sFPCPutMovieFromMemory
lpData As Long
dwSize As Long
End Type

Private Sub cmdCommand1_Click()

Dim MyFPCPutMovieFromMemory As sFPCPutMovieFromMemory
RegisterFlashWindowClass
Dim rc As Rect
GetClientRect hWnd, rc

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

FPCSetEventListener hwndFlashPlayerControl, AddressOf FlashEventsListener, 0


Dim bytes() As Byte
bytes = ReadBytesFromFile("C:\Send_Get_Test.swf")

MyFPCPutMovieFromMemory.lpData = bytes
MyFPCPutMovieFromMemory.dwSize = UBound(bytes)
Call SendMessage(hwndFlashPlayerControl, FPCM_PUTMOVIEFROMMEMORY, 0, VarPtr(MyFPCPutMovieFromMemory))

End Sub

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

Re: LoadMovieFromMemory did not work with vb..

Postby Softanics » Mon Sep 04, 2006 12:02 pm

Thank you for your question.

mobildev wrote:MyFPCPutMovieFromMemory.lpData = bytes


Is it correct?...
May be you shoud use something like that ( http://support.microsoft.com/kb/199824/EN-US/ ):

Code: Select all

MyFPCPutMovieFromMemory.lpData = VarPtr(bytes(0))
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

mobildev
Posts: 9
Joined: Mon Sep 04, 2006 7:29 am

Yes,...but?

Postby mobildev » Mon Sep 04, 2006 12:15 pm

Thanks. You are Right..I correct it and working now..

But In my computer; my sample and samples that I downloaded from your site has another problem:
I run the code, ok it is working. stop it, close form..and reRun project again and see an error(This happens not all time, sometimes happens.) And this error not has an explanation, I think it is an error that is about dll own functions..
( Maybe error is about UnregisterFlashWindowClass() func. )

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

Postby Softanics » Mon Sep 04, 2006 12:24 pm

I think the error is related with registration/unregistration flashplayercontrol window class. When you work in VB6, you run the project in VB6 process. So if you forget to unregister the window class, the next call of RegisterFlashWindowClass will fail. The best solution for that is to reopen the VB6 IDE.
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 14 guests

cron