Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic Libraries (Windows)
#16
(12-13-2025, 11:16 PM)ahenry3068 Wrote:
(12-13-2025, 09:03 PM)Petr Wrote: This version is more stable, none child / parent handle. Previous version freeze after 2 minutes (divX video), this not, is stable:

Code: (Select All)

Option _Explicit

Declare Dynamic Library "winmm"
    Function mciSendStringA& (lpstrCommand As String, lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As _Offset)
    Function mciGetErrorStringA& (ByVal dwerrsor As Long, lpstrBuffer As String, ByVal uLength As Long)
End Declare

Dim handle&: handle& = _NewImage(800, 600, 32)
Screen handle&
_Title "QB64 Video"

Dim hwnd As _Offset: hwnd = _WindowHandle

Dim filename As String, aliasName As String
filename = "(2014)na.avi"
aliasName = "vid"

Dim cm As String, e As Long
Dim dummy As String: dummy = Space$(1)

' 1) Open
cm = "open " + Chr$(34) + filename + Chr$(34) + " type mpegvideo alias " + aliasName
e = mciSendStringA&(cm, dummy, 0, 0): MCI_Check e, cm

' 2) Attach to QB64 window handle (more stable than parent/style child)
cm = "window " + aliasName + " handle " + LTrim$(Str$(hwnd))
e = mciSendStringA&(cm, dummy, 0, 0): MCI_Check e, cm

' 3) Set destination rect (not "put window at")
cm = "put " + aliasName + " destination at 0 0 800 600"
e = mciSendStringA&(cm, dummy, 0, 0): MCI_Check Err, cm

' 4) Play
cm = "play " + aliasName
e = mciSendStringA&(cm, dummy, 0, 0): MCI_Check Err, cm

Do
    _Limit 60
    _Display ' let s messages going and window as active (QB64 help)
Loop Until InKey$ <> ""
Dim N As Long
N = mciSendStringA&("stop " + aliasName, dummy, 0, 0)
N = mciSendStringA&("close " + aliasName, dummy, 0, 0)
End

Sub MCI_Check (errsCode As Long, where As String)
    Dim n As Long
    If errsCode <> 0 Then
        Dim msg As String
        msg = Space$(256)
        n = mciGetErrorStringA&(errsCode, msg, Len(msg))
        Print "MCI error ("; errsCode; "): "; where
        Print RTrim$(msg)
        Sleep
        End
    End If
End Sub

     Have you done any research into duplicating this capability on Linux,  Perhaps with the VLC or FFMPEG libraries ??
(Also if you use one of those libraries I bet it's possible to more easily have $IF's  in the Code for OS targeting  !
So far I've tried to deal with Linux twice. Unsuccessfully. The system is confusing to me personally. I tried it from a virtualized environment via Ubuntu, but most things there are completely different from Windows. I already have an IDE installed in Linux, I also have a C compiler there, yes, all that. But now I've been more on Windows. Of course, I would also be happy if everything in this thread could be run on Linux. I'll try. But don't expect quick progress, because there are a lot of unknowns for me. I'll definitely try. As soon as you see the Dynamic Libraries (SO) thread here, you'll know that I've succeeded with something... yes, I also thought about the use of ffmpeg dynamic libraries. This is a good option.


Reply


Messages In This Thread
Dynamic Libraries (Windows) - by Petr - 12-08-2025, 06:48 PM
RE: Dynamic Libraries - by Petr - 12-08-2025, 07:12 PM
RE: Dynamic Libraries - by Petr - 12-08-2025, 07:52 PM
RE: Dynamic Libraries - by Jack - 12-08-2025, 08:41 PM
RE: Dynamic Libraries - by Petr - 12-09-2025, 07:21 PM
RE: Dynamic Libraries - by Petr - 12-11-2025, 04:19 PM
RE: Dynamic Libraries - by Petr - 12-12-2025, 10:00 PM
RE: Dynamic Libraries - by Petr - 12-13-2025, 05:56 PM
RE: Dynamic Libraries - by 2112 - 12-13-2025, 07:06 PM
RE: Dynamic Libraries - by ahenry3068 - 12-13-2025, 07:47 PM
RE: Dynamic Libraries - by Petr - 12-13-2025, 07:41 PM
RE: Dynamic Libraries - by 2112 - 12-13-2025, 08:23 PM
RE: Dynamic Libraries - by Petr - 12-13-2025, 08:36 PM
RE: Dynamic Libraries - by Petr - 12-13-2025, 09:03 PM
RE: Dynamic Libraries - by ahenry3068 - 12-13-2025, 11:16 PM
RE: Dynamic Libraries - by Petr - 12-14-2025, 12:15 AM
RE: Dynamic Libraries - by Petr - 12-15-2025, 08:22 AM
RE: Dynamic Libraries (Windows) - by Petr - 12-15-2025, 06:30 PM
RE: Dynamic Libraries (Windows) - by Mad Axeman - 12-19-2025, 02:37 PM
RE: Dynamic Libraries (Windows) - by Pete - 12-18-2025, 07:45 PM
RE: Dynamic Libraries (Windows) - by Steffan-68 - 12-18-2025, 08:31 PM
RE: Dynamic Libraries (Windows) - by Pete - 12-18-2025, 08:55 PM
RE: Dynamic Libraries (Windows) - by Steffan-68 - 12-18-2025, 09:48 PM
RE: Dynamic Libraries (Windows) - by Petr - 12-18-2025, 09:32 PM
RE: Dynamic Libraries (Windows) - by Pete - 12-18-2025, 11:53 PM
RE: Dynamic Libraries (Windows) - by Pete - 12-19-2025, 06:40 AM
RE: Dynamic Libraries (Windows) - by Petr - 12-19-2025, 03:08 PM
RE: Dynamic Libraries (Windows) - by Petr - 12-19-2025, 10:35 PM
RE: Dynamic Libraries (Windows) - by Petr - 12-19-2025, 10:54 PM
RE: Dynamic Libraries (Windows) - by Petr - 12-19-2025, 11:20 PM
RE: Dynamic Libraries (Windows) - by Pete - 12-19-2025, 11:37 PM
RE: Dynamic Libraries (Windows) - by Petr - 12-20-2025, 10:22 PM
RE: Dynamic Libraries (Windows) - by SMcNeill - 12-20-2025, 11:03 PM
RE: Dynamic Libraries (Windows) - by Petr - 12-21-2025, 05:40 PM
RE: Dynamic Libraries (Windows) - by Petr - 12-22-2025, 08:23 PM
RE: Dynamic Libraries (Windows) - by Petr - 12-23-2025, 09:06 AM
RE: Dynamic Libraries (Windows) - by Petr - 12-24-2025, 09:54 PM
RE: Dynamic Libraries (Windows) - by Petr - 12-25-2025, 10:02 AM
RE: Dynamic Libraries (Windows) - by Petr - 12-26-2025, 11:14 PM
RE: Dynamic Libraries (Windows) - by Petr - 12-27-2025, 01:35 PM
RE: Dynamic Libraries (Windows) - by MasterGy - 12-27-2025, 07:23 PM
RE: Dynamic Libraries (Windows) - by Petr - 01-07-2026, 06:31 PM
RE: Dynamic Libraries (Windows) - by Petr - 01-07-2026, 09:13 PM
RE: Dynamic Libraries (Windows) - by Petr - 02-24-2026, 06:38 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Dynamic Libraries (Linux) Petr 19 1,162 12-29-2025, 09:52 PM
Last Post: Petr

Forum Jump:


Users browsing this thread: 1 Guest(s)