Announcement

Collapse
No announcement yet.

How to change AVI in dialog (from resource file)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to change AVI in dialog (from resource file)

    I have in resource file 2 x AVI defined:
    Code:
    my_avi1       AVI    "test1.AVI"
    my_avi2       AVI    "test2.AVI"
    How to replace/change AVI, for example from my_avi1 to my_avi2 in:
    Code:
    CONTROL ADD "SysAnimate32", hDlg, %IDC_SYSANIMATE32_1, "my_avi1", 6, 6, 24, 24, _
                                %WS_CHILD OR %WS_VISIBLE OR %ACS_CENTER OR %ACS_TRANSPARENT OR %ACS_AUTOPLAY
    It is possible to make it with SetDlgItemInt or SendMessage?
    ..but how?

    Thanks
    Yours sincerely

  • #2
    From the doc it looks like you can just send ("CONTROL SEND") ACM_CLOSE message to stop current clip, and ACM_OPEN to start a new one.

    Failing that, I don't see why you couldn't just destroy that control and recreate it with a different clip.
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Michael, thanks!
      It's works and without %ACM_CLOSE ??, but with %ACM_STOP

      Code:
      CONTROL SEND hDlg, %IDC_SYSANIMATE32_1, %ACM_STOP, 0, 0
      CONTROL SEND hDlg, %IDC_SYSANIMATE32_1, %ACM_OPEN, 0, dwDlgAvi
      dwDlgAvi -> %IDRC_AVIFILE1, %IDRC_AVIFILE2 ...
      Last edited by Alexander Holzer; 21 Jul 2008, 05:44 AM.
      Yours sincerely

      Comment


      • #4
        Hello, Michael,
        how to receive the message from SysAnimate32 control (for user clicks or double-clicks)?

        I try with:
        Code:
        CASE %WM_NOTIFY
        	  pNMHDR = CBLPARAM
        	  IF @pNMHDR.idFrom = %IDC_SYSANIMATE32_1 AND @pNMHDR.code = %NM_CLICK THEN ...
        ..but without success

        Thanks
        Last edited by Alexander Holzer; 22 Jul 2008, 04:16 AM.
        Yours sincerely

        Comment


        • #5
          I don't see in the doc where the animation control sends a click notification via WM_NOTIFY or any other way.

          An animation control can send two notification messages, ACN_START and ACN_STOP, to its parent window. Most applications do not handle either notification.
          You may have to subclass the control to pick off WM_RBUTTONUP or something like that.
          Michael Mattias
          Tal Systems Inc. (retired)
          Racine WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            Here's a way without subclassing..
            Code:
             
            #Compile Exe
            #Include "WIN32API.INC"
            #Include "COMMCTRL.INC"
             
            %IDC_SYSANIMATE32_1 = 101
            '------------------/
             
             CallBack Function DlgProc()
              Local Rct As RECT
                Select Case CbMsg
                 Case %WM_LBUTTONDOWN
                    GetClientRect GetDlgItem(CbHndl, %IDC_SYSANIMATE32_1), Rct
                    If PtInRect(Rct, LoWrd(CbLParam), HiWrd(CbLParam)) Then
                      Dialog Set Text CbHndl, "Mouse click"
                    End If
                  Case %WM_LBUTTONDBLCLK
                    GetClientRect GetDlgItem(CbHndl, %IDC_SYSANIMATE32_1), Rct
                    If PtInRect(Rct, LoWrd(CbLParam), HiWrd(CbLParam)) Then
                      WinBeep 800, 50
                      Dialog Set Text CbHndl, "Mouse double-click"
                    End If
             
                  Case %WM_COMMAND
                    Select Case CbCtl
                      Case %IDC_SYSANIMATE32_1
                        Select Case CbCtlMsg
                          Case %ACN_STOP
                            Dialog Set Text CbHndl, "stop"
                          Case %ACN_START
                            Dialog Set Text CbHndl, "start"
                          Case Else
                            Dialog Set Text CbHndl, Format$(CbCtlMsg)
                        End Select
                    End Select
                End Select
            End Function 
            '------------------/
             
            Function PBMain()
             Local hDlg, hCtl As Dword
              Call InitCommonControls
             
              Dialog New Pixels, 0, "", 300, 200, 400, 400, %WS_POPUP Or %WS_CAPTION Or %WS_SYSMENU, To hDlg
              Control Add "SysAnimate32", hDlg, %IDC_SYSANIMATE32_1, "", 10, 10, 320, 320, _
                  %WS_CHILD Or %WS_VISIBLE Or %ACS_CENTER 'OR %ACS_TRANSPARENT
              Control Handle hDlg, %IDC_SYSANIMATE32_1 To hCtl
             
              Animate_Open hCtl, "c:\windows\clock.avi"    '%ACM_OPEN
              Animate_Play hCtl, 0, -1, 1                  '%ACM_PLAY
             
              Dialog Show Modal hDlg, Call DlgProc
             
            End Function 
            '------------------/
            Rgds, Dave

            Comment


            • #7
              Dave, thanks!
              It works fine.
              :top:
              Yours sincerely

              Comment


              • #8
                That's a clever solution. I like that.
                Michael Mattias
                Tal Systems Inc. (retired)
                Racine WI USA
                [email protected]
                http://www.talsystems.com

                Comment


                • #9
                  Credit should go to Lance - it's a technique suggested in one of his posts.
                  Oh, and Borje too (for POFFS) of course
                  Rgds, Dave

                  Comment

                  Working...
                  X