CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2000
    Posts
    127

    Open a file which automatically opens addtional 2 files

    Suppose I want to open a bmp file using a file dialog . In addition to opening this bmp file I also want to open another 2 files : .dat & .wav files . These 3 files are of same name but just different types. I am trying to say is that by opening the bmp file using the file dialog , the other 2 files are also automatically opened with the bmp file. I need a file dialog because I have alot of this bmp files with the .dat & .wav files. For the .dat files , i already have procedures opening it . I need to know how can i open the bmp file using a dialog & by doing so , the .dat & .wav files of the same name as the bmp file can also automatically opened .


  2. #2
    Join Date
    Jan 2000
    Location
    Nottingham, UK
    Posts
    51

    Re: Open a file which automatically opens addtional 2 files

    The other files can't be automatically opened, but it's easy to do what you want nevertheless.

    Once the file dialog returns with the file name of the *.bmp file, just create two more strings, copied from the *.bmp file name string, but with the bmp replaced with dat and wav respectively.

    e.g. something like (and I haven't tested this)
    CommonDialog.FileName = ""
    CommonDialog.Filter = "bmp (*.bmp)|*.bmp"
    CommonDialog.ShowOpen
    If CommonDialog.FileName = "" then Exit Sub
    bitmapName = CommonDialog.FileName
    waveName = left(bitmapName, InStr(bitmapName, ".")) & "wav"
    dataName = left(bitmapName, InStr(bitmapName, ".")) & "dat"

    Then open each of the three files in the normal way.

    Ian


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

Featured