Results 1 to 5 of 5

Thread: Common Dialog Problem?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2001
    Location
    Louisiana, USA
    Posts
    24

    Question Common Dialog Problem?

    I have put a Munu Bar into my application with the following code in the File|Open Click Event:
    Private Sub mnuOpen_Click()
    Dim tFile As String
    CommonDialog1.DialogTitle = "Open File"
    CommonDialog1.Filter = "Word Documents (*.doc)|*.doc|Text (*.txt)|*.txt|Rich Text (*.rtf)|*.rtf"
    CommonDialog1.FilterIndex = 1
    CommonDialog1.Flags = cdlOFNFileMustExist + cdlOFNHideReadOnly
    CommonDialog1.CancelError = True
    On Error Resume Next
    CommonDialog1.ShowOpen
    If Err Then
    MsgBox "Dialog Cancelled"
    Exit Sub
    End If
    tFile = FreeFile
    Open CommonDialog1.FileName For Input As tFile
    Text4.Text = Input(LOF(tFile), tFile)
    Close tFile
    MsgBox "You selected " & CommonDialog1.FileName
    Exit Sub
    End Sub
    This displays text saved to the hard drive into a text box with no problem.

    I also have a Cmd Button that plays an .avi file with the following code using the MM API in a module.
    Private Sub cmdVideo_Click()
    On Error Resume Next
    Dim returnstring As String
    Dim FileName As String
    Dim i As String
    Dim CommandString As String
    returnstring = Space(127)
    'AVIfile to play
    If txtunit = "1" And txtlesson = "1" Then
    FileName = "Introduction.avi"
    i = mciSendString("open " & Chr$(34) & FileName & _
    Chr$(34) & " type avivideo alias intro", returnstring, _
    127, 0)
    i = mciSendString("set video time format ms", _
    returnstring, 127, 0)
    i = mciSendString("play intro from 0", returnstring, _
    127, 0)
    i = mciSendString("play intro", 0&, 0, 0)
    End If
    (Repeted for additional videos)
    There is also a cmdClose to close the video.

    The problem is, after adding the Menu control the videos will no longer play with the cmdVideo Button. I have several other cmd Buttons that still function correctly, only the cmdVideo & cmdClose quit working. Any ideas what the problem is?

  2. #2
    Dreamlax
    Guest
    Try changing the FileName variable in the cmdVideo_Click() event to something else. I think it might be conflicting with the FileName property of the CommonDialog control... but perhaps not.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 2001
    Location
    Louisiana, USA
    Posts
    24
    Thanks, Dreamlax but no that did not solve the problem.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Dec 2001
    Location
    Louisiana, USA
    Posts
    24
    Anyone else have an idea?

  5. #5
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    try setting a breakpoint at the start of the 2 events and step through when you hit the button..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width