• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

bc9-avi example

Started by James C. Fuller, March 02, 2016, 01:55:38 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

James C. Fuller


'=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
'bc9-Avi.bas: bc9_Dialog version of a BCX classic written by Mr BCX
'This is the same as the Project version but shows how to create a resource
'file in code. All c/c++ batch files look for an rc file with the same name
'as the .c|.cpp to add to the exe. Internally the translator appends "__" to
'the file name (for historic reasons I left it alone). Here we make a copy
'and then delete the created files after use.
'=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
$NOMAIN
'let the batch files handle the rc -> res
$ONEXIT "copy $FILE$__.rc $FILE$.rc"
'------------------------------------------------------------------------------
$ONEXIT "VSC.BAT $FILE$ -m64 gui"
'------------------------------------------------------------------------------
'delete the bc9 created files after we are done.
$ONEXIT "del $FILE$__.rc & del $FILE$.rc & del $FILE$.res"

'==============================================================================
Const ID_START = 101
Const ID_STOP = 102
Global hDlg2 AS HWND
'==============================================================================
'Create a resource file
$BCX_RESOURCE
    #define MANIFEST 24
    #define IDR_XPMANIFEST1 1
    IDR_XPMANIFEST1 MANIFEST "xpmanifest.xml"
$BCX_RESOURCE
'==============================================================================
Function WinMain()
    Raw lpdp As PDLGTEMPLATEEX
    Local As HWND hDlg1
    lpdp = bc9_Dialog("AVI-Control",200,100,160,40,0,0,"Tahoma",10)
    bc9_button("Start",&lpdp,ID_START,15,15,40,15)
    bc9_button("Stop",&lpdp,ID_STOP,100,15,40,15)
    hDlg1 = bc9_DlgShow(lpdp,(DLGPROC)DlgProc,0)
    lpdp = bc9_Dialog("AVI-Screen",0,0,175,100)
    bc9_Label("AVI will play here",&lpdp,-1,110,75,100,15)
    hDlg2 = bc9_DlgShow(lpdp,(DLGPROC)DlgProc,0)
    Center(hDlg2)
    If hDlg1 = 0 Then   
        MsgBox("BAD")
        Function = 1
    End If
    Function = bc9_MsgPump()
End Function
'==============================================================================
Begin Dialog As DlgProc
    Select Case CBMSG
        Case WM_DESTROY
            PostQuitMessage(0)
        Case WM_COMMAND
            If CBCTL = ID_STOP Then
                mciSendString ("close all",0,0,0)
            EndIf
            If CBCTL = ID_START Then
                Dim A$
                Raw As INT_PTR I = (INT_PTR)hDlg2
                A$ = "Open test.avi type AVIVideo alias AVIFile parent " _
                & STR$(I) & " STYLE " & STR$ (WS_CHILD)
                mciSendString ( A$,0,0,0 )
                mciSendString ("Put  AVIFile Window At 0 0 350 200",0,0,0 )
                mciSendString ("Play AVIFile repeat",0,0,0 )
                Exit Function
            End If
            Exit Function
        Case WM_CLOSE
            Local id
            id = Msgbox("Are you sure?","Quit Program!",MB_YESNO OR MB_ICONQUESTION)
            If id = IDYES Then
                mciSendString ("close all",0,0,0)
                PostQuitMessage(0)
            EndIf
    End Select
End Dialog