Announcement

Collapse
No announcement yet.

Running animation from a PBR resource

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

  • Fred Oxenby
    replied
    I think this will be to much for my little head...
    Look at this example of RC-files
    Code:
     File #1
       #define FIL_SEARCH 101
       #define FIL_DELETE 102
       FIL_SEARCH AVI DISCARDABLE FILECOPY.AVI
       FIL_DELETE AVI DISCARDABLE FILEDELR.AVI
    -----------
    Resourse can only be referenced with the name, not the number
    i.e Call Animate_Open(hAni&,"FIL_DELETE")
    -----------
     File #2
       #define FIL_SEARCH 101
       #define FIL_DELETE 102
       101 AVI DISCARDABLE FILECOPY.AVI
       102 AVI DISCARDABLE FILEDELR.AVI
    -----------
    Resource can only be referenced with its number, not the name
    i.e Call SendMessage(hAni&, %ACM_OPEN,%Null,MakDwd(102,0))
    i.e Call Animate_Open(hAni&,ByVal MakDwd(102,0))
    
    -----------
    This is probably common knowledge for all of you, but to me it just
    hit me when fooling around with RESHACK and RSRC
    But the real problem is still PBRES.
    Is this problem referenced in this thread known to R&D (I suppose so..)
    and will there be a fix for it in future releases
    Resorting to external programs to fix it will not work in the debugger.

    ------------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se



    [This message has been edited by Fred Oxenby (edited September 11, 2000).]

    Leave a comment:


  • Fred Oxenby
    replied
    This is just to confirm:
    If using a PBR I can start/display an animation using
    1) Resource-Item number (Call SendMessage(hAni&, %ACM_OPEN,%Null,MakDwd(102,0)))
    2) Resource-Item Name (Call Animate_Open(hAni&,"FIL_DELETE"))
    with the resource that appear in the first Resource-ID "AVI"
    --------
    Using RSRC adding the resources both 1) and 2) works with unlimited number
    of AVI-resources


    ------------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Leave a comment:


  • Fred Oxenby
    replied
    I think I have spotted the problem.
    1033 or 1053 is probably the languageid and nothing else
    Resources should be stored like this
    Code:
      RESOURCETYPE "AVI"
        RESOURCEITEM "101"
         LANGUAGEID "1033"
        RESOURCEITEM "102"
         LANGUAGEID "1033"
      RESOURCETYPE "SOMETHINGELSE"
        RECOURCEITEM "WHATEVER
        ....
    But PBRES stores them like this:
    Code:
      RESOURCETYPE "AVI"
        RESOURCEITEM "101"
         LANGUAGEID "1033"
      RESOURCETYPE "AVI"
        RESOURCEITEM "102"
         LANGUAGEID "1033"
      RESOURCETYPE "SOMETHINGELSE"
      ...
    This will result in only the res-item stored under the first Res-type will be available.
    Res-item 102 will not load, but res-item 101 will.
    This is verified with my testprogram and a PBR created with PBRES.



    ------------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Leave a comment:


  • Fred Oxenby
    replied
    You are quite right JC.
    Embedding the RES-file with RSRC in the exe-file, then things works
    as it should do.
    Checking the EXE with RESHACK gives me AVI-resourses stored as
    it is in a C++ DLL
    Thanks, this indicate problem is with PBRES
    ---
    Using RESHACK AVI-resources is shown as 'type 1033' when compiled with PBRES
    but in the C++ DLL and using RSRC shown as 'type 1053'
    ---
    Using RESHACK to add the AVI-resource also gives 'type 1053' and the code works.


    ------------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se



    [This message has been edited by Fred Oxenby (edited September 11, 2000).]

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Fred,

    The only difference I see between the PB res and your
    C res is in the res ID in the C version.

    Here is what I found on MSDN regarding passing the string in
    lieu of a resource ID:

    In the preceding code, I passed an identifier to the AVI
    resource rather than passing in the name of the AVI file. This
    means that the clip will be built into the sample. When I first
    wrote the code, I passed in the name of the clip. But this wasn't
    the best option because I had to pass in the full path. (If you
    don't pass in the full path, the call to open the AVI file will
    fail and the clip will not run.) To add the clip to my resource,
    I inserted the following line in my MFCANIM.RC2 file:
    Hope this helps. Try using a resource ID in the PB res and see
    what happens!!

    Cecil

    ------------------

    Leave a comment:


  • jcfuller
    replied
    Fred,
    To make sure it is PBRES try using www.jcfuller.com/rsrc.zip to embed
    the res file in the exe.

    James


    ------------------

    Leave a comment:


  • Fred Oxenby
    replied
    Thanks Semen,
    I always look at, and remember by hart, your code-snippets.
    But I want to get things working as they are supposed to do.
    If I create a DLL in C++ with this resource
    Code:
    #define FIL_SEARCH 101
    #define FIL_DELETE 102
    FIL_SEARCH              AVI     DISCARDABLE     "FILECOPY.AVI"
    FIL_DELETE              AVI     DISCARDABLE     "FILEDELR.AVI"
    and use this code everything works ok
    Code:
      hDLL& = Loadlibrary("AVI.DLL")
      #Debug Print Str$(SendMessage(hAni&, %ACM_OPEN,hDLL&,MakDwd(101,0)))
    But if I create a DLL in PB/DLL6 with the same resources it does not work
    --
    I had to use a DLL to verify that it is possible to play a SysAnimate32-animation
    from a resource.
    But resources created with PBRES will not do.
    Someone willing to confirm or challenge this?


    ------------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se
    PS: My includes are always secured against accidental overwrites


    [This message has been edited by Fred Oxenby (edited September 11, 2000).]

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Fred,

    Are you sure about the following code:

    #Include "\!INCLUDE\WIN32API.BAS"
    #Include "\!INCLUDE\COMMCTRL.BAS"

    Or would it be:

    #Include "\!INCLUDE\WIN32API.INC"
    #Include "\!INCLUDE\COMMCTRL.INC"

    Cecil

    ------------------

    Leave a comment:


  • Semen Matusovski
    replied
    fred --
    i don't know answer on youe question, but i suggest to look http://www.powerbasic.com/support/pb...ad.php?t=22720

    ------------------
    e-mail: [email protected]

    Leave a comment:


  • Fred Oxenby
    started a topic Running animation from a PBR resource

    Running animation from a PBR resource

    I cannot figure this out, someone to help clarify.
    From MSDN
    BOOL Animate_Open(HWND hwnd,LPSTR lpszName);
    Parameters
    hwnd Handle to the animation control.
    lpszName Address of a buffer that contains the path of the AVI file
    or the name of an AVI resource. Alternatively, this parameter
    can consist of the AVI resource identifier in the low-order word
    and zero in the high-order word. To create this value, use the
    MAKEINTRESOURCE macro.
    The control loads an AVI resource from the module specified by the
    instance handle passed to the CreateWindow function, the Animate_Create
    macro, or the dialog box creation function that created the control.
    The AVI file or resource specified by lpszName must not contain audio.

    If this parameter is NULL, the system closes the AVI file that was previously
    opened for the specified animation control, if any.
    My question is then very simple: Why does not this work?

    Code:
    #Compile Exe
    #Resource "MYAVI.PBR"
    #Include "\!INCLUDE\WIN32API.BAS"
    #Include "\!INCLUDE\COMMCTRL.BAS"
    
    Function PbMain()As Long
    
    Style& = %WS_POPUPWINDOW Or %DS_MODALFRAME Or %WS_CAPTION Or %DS_CENTER
    ExStyle& = 0
    AniStyle& = %WS_CHILD Or %WS_VISIBLE Or %ACS_AUTOPLAY Or %ACS_TRANSPARENT 'Or %ACS_CENTER
    AniStyleEx& = 0 
      Dialog New %NULL, "Animation test", 0, 0,  200,40, Style&, ExStyle& To hDlg&
      Control Add "SysAnimate32", hDlg&, 1000,"",0,0,200,40,AniStyle&,AniStyleEx&
      Control Handle hDlg&,1000 To hAni&
      #Debug Print Str$(Animate_Open(hAni&,"FIL_SEARCH"))
      Dialog Show Modal hDlg&
    End Function
    --
    RC-file "MYAVI.RC"
    FIL_SEARCH AVI FILECOPY.AVI
    FIL_DELETE AVI FILEDELR.AVI

    ------------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

Working...
X