IT-Berater: Theo Gottwald (IT-Consultant) > Freebasic

FreeBASIC Movie Control

(1/3) > >>

Juergen Kuehlwein:
Hi José,


again i need your help...


Trying to port a movie control for PowerBASIC to FreeBASIC i run into (maybe COM related) problems i don´t understand. Attached is my sample code, which is reduced in size removing all unnecessary things but still demonstrating my problems.

Based on code i found in your WinFBX and a movie example for FreeBASIC it wasn´t to hard to get it running in 32 bit and unicode defined. But if i don´t define unicode in 32 bit, the GraphBuilder object isn´ created, the app shows random behavior and sometimes crashes (in user32.dll or ntdll.dll). For 64 bit the GraphBuilder object is created regardless if unicode is defined or not, but the movie doesn´t run and the app doesn´t end gracefully, it gets stuck when releasing the objects in "resetmovie". 

What am i doing wrong ?


Thanks


JK

José Roca:
Sorry, but I don't find where is the problem. Sometimes works and sometimes don't, but it doesn't fail consistently in the same place.

Juergen Kuehlwein:

--- Quote --- but it doesn't fail consistently in the same place
--- End quote ---


that´s exactly what i experience too! The general approach seems to be sound, because it´s PB equivalent works. I have several implementations of it running for years now without any problem.

This erratic behavior makes me think of memory corruption - but how and where? In PB i don´t have to initialize the common controls and i don´t have to call coinitialize because PB does it for me, the rest is more or less the same. To my (limited) experience COM seems to be much more sensitive to improper arguments compared to the Windows API. That is, it is much easier to crash an app by passing wrong arguments to a COM object than to the Windows API (even if it is possible there too).

With unicode defined it runs for 32 bit, as soon as you don´t define it, the problems begin. COM needs wide strings, i account for this. Maybe a problem with the include files ?

The FreeBASIC sample code (examples\win32\COM\MoviePlayer) doesn´t compile, it throws a linker error i don´t understand, so no help either...


So as far as you can tell, there isn´t a fundamental error in my implementation of COM in my code ?   


JK

José Roca:
I translated my PowerBasic example to FreeBasic and it worked fine:

http://www.planetsquires.com/protect/forum/index.php?topic=4023.msg30348#msg30348

although for the moment it can't be recompiled because of bugs in windowsx.bi.

The only problem that I remember was that I had to use

hr = pIMediaControl->lpvtbl->RenderFile(pIMediaControl, @wszFileName)

instead of the RenderFile method of the IGraphBuilder interface.

Pierre Bellisle:

--- Code: ---hr = IGraphBuilder_RenderFile(c->pIGraphBuilder, @wtext, NULL)
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version