Announcement

Collapse
No announcement yet.

Animate does not function after OpenFileDialog!?

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

  • Animate does not function after OpenFileDialog!?

    Hello,
    I stated that Animate_Open/_Play without function after OpenFileDialog call.

    Try PBwin-example "Animate.bas" edit:

    Code:
    ...
    [COLOR="Red"]#INCLUDE "ComDlg32.inc"[/COLOR]
    ...
    
    FUNCTION PBMAIN () AS LONG
    
        LOCAL hDlg AS DWORD
    
    [COLOR="Red"]local f as string
    local lstyle as long
    
    f = "*.txt"
    lstyle = %ofn_filemustexist or %ofn_hidereadonly or %ofn_longnames
    openfiledialog(0, "open file", f, "c:\", _
    "text files|*.txt|all files|*.*", "txt", lstyle)[/COLOR]
    
        InitComCtl32(%ICC_ANIMATE_CLASS)
    
        DIALOG NEW 0, "Animation demo",,, 185, 60, %WS_CAPTION OR %WS_SYSMENU, _
    ...
    and open you any for TXT file. Now try to start animation.
    Idea?

    Thanks.
    Last edited by Alexander Holzer; 7 Oct 2008, 08:34 AM.
    Yours sincerely

  • #2
    Ms

    Apparently there is a memory or Z-order conflict if you try to run the open file dialog before the animate control is operational. You should send this to [email protected].

    If you place the open file code into the callback in the %WM_INITDIALOG case after this line:

    Animate_Open hAnimate, "FILECOPY.AVI"

    Then it will work.
    Rick Angell

    Comment


    • #3
      Thank you Richard.
      In the example - yes ,but in the correct program it will implement with difficulty.
      Yours sincerely

      Comment


      • #4
        In your program, code unseen here yet, it appears the openfile call should still come after the animate control has been loaded and a file provided to it ...

        What version of PBWin are you using?
        Last edited by Richard Angell; 8 Oct 2008, 09:33 AM.
        Rick Angell

        Comment


        • #5
          Originally posted by Richard Angell View Post
          In your program, code unseen here yet, it appears he openfile call should still come after the animate control has been loaded and a file provided to it ...

          What version of PBWin are you using?
          PBWin 9.0
          The mistake or disputed situation with OpenFileDialog and Animate_Open/_Play exist. Also it is the fact.
          Yours sincerely

          Comment


          • #6
            Which OS version are you using?
            Rick Angell

            Comment


            • #7
              The OpenFileDialog API call is changing the current directory when selecting a file. Therefore the
              Code:
              Animate_Open hAnimate, "FILECOPY.AVI"
              cannot locate the file "FILECOPY.AVI". You can use the style bit of %OFN_NOCHANGEDIR and the API will keep the current directory the same or use the full path to the AVI filename.
              Sincerely,

              Steve Rossell
              PowerBASIC Staff

              Comment


              • #8
                Thanks Steve!
                Now everything is clear.
                Yours sincerely

                Comment


                • #9
                  From MSDN Library:

                  OFN_NOCHANGEDIR
                  Restores the current directory to its original value if the user changed the directory while searching for files.

                  Windows NT 4.0/2000/XP: This flag is ineffective for GetOpenFileName.

                  Comment


                  • #10
                    Bruce,
                    Where is that??? I am curious if its when user hits "Search", and then in another window goes to check something else???

                    Or if it holds the last known folder? (and maybe better than some other techniques)
                    Engineer's Motto: If it aint broke take it apart and fix it

                    "If at 1st you don't succeed... call it version 1.0"

                    "Half of Programming is coding"....."The other 90% is DEBUGGING"

                    "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                    Comment


                    • #11
                      Where is that???
                      What?
                      If you mean %OFN_NOCHANGEDIR it is in the help file under 'flags' in the DISPLAY OPENFILE page.
                      Rod
                      In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.

                      Comment


                      • #12
                        Check this link
                        http://msdn.microsoft.com/en-us/library/ms646839.aspx

                        Comment


                        • #13
                          Try this on XP SP2 or SP3, then see if you believe MS that the %OFN_NOCHANGEDIR flag has no effect in XP

                          Code:
                          #COMPILE EXE
                          #DIM ALL
                          FUNCTION PBMAIN () AS LONG
                              LOCAL PFN$,olddir$
                              olddir$ = CURDIR$
                              ? "Change to a different directory and select any file,each time."
                              DISPLAY OPENFILE 0, , , "",CURDIR$ , "", _
                                              "*.*", "", %OFN_ENABLESIZING OR _
                                              %OFN_FILEMUSTEXIST OR %OFN_PATHMUSTEXIST OR _
                                              %OFN_EXPLORER TO PFN$
                                              
                              ? "WAS directory: "+ olddir$ + $CRLF + _
                                "IS  directory:  "+ CURDIR$ + $CRLF + $CRLF + "file selected:  "+ PFN$,, "omit %OFN_NOCHANGEDIR"
                              
                              CHDIR olddir$  'back to square one
                          
                              DISPLAY OPENFILE 0, , , "",CURDIR$ , "", _
                                              "*.*", "", %OFN_ENABLESIZING OR _
                                              %OFN_FILEMUSTEXIST OR %OFN_PATHMUSTEXIST OR _
                                              %OFN_EXPLORER OR %OFN_NOCHANGEDIR TO PFN$
                          
                              ? "WAS directory: "+ olddir$ + $CRLF + _
                                "IS  directory:  "+ CURDIR$ + $CRLF + $CRLF + "file selected:  "+ PFN$,,"with %OFN_NOCHANGEDIR results"
                          END FUNCTION
                          on this XP system it does!
                          Rick Angell

                          Comment

                          Working...
                          X