uses FileDialogs
uses console
OPENFILENAME ofn
char FileBuf[2048]
int  FileBufLen=2048
'
 ofn.lStructSize       = sizeof(OPENFILENAME)
'ofn.hwndOwner         = hWnd
 ofn.hInstance         = GetModuleHandle
'ofn.lpstrFilter       = filter
 ofn.lpstrCustomFilter = null
 ofn.nMaxCustFilter    = 0
'ofn.nFilterIndex      = 1
 ofn.lpstrFile         = FileBuf 'coupling to char buffer
 ofn.nMaxFile          = FileBufLen
 ofn.lpstrFileTitle    = null
 ofn.nMaxFileTitle     = 0
'ofn.lpstrInitialDir   = idir
 ofn.lpstrTitle        = "Multi-Select"
 ofn.Flags             = OFN_EXPLORER | OFN_ALLOWMULTISELECT
 ofn.nFileOffset       = 0
 ofn.nFileExtension    = 0
 ofn.lpstrDefExt       = null
 ofn.lCustData         = 0
 ofn.lpfnHook          = 0
 ofn.lpTemplateName    = null


if GetOpenFileName ofn
  print "files selected" cr
  char*pt
  @pt=@FileBuf
  int j
  int fcount
  j=ofn.nFileOffset
  print "Directory path: "+left(pt,j)+cr
  @pt+=j      
  while asc(pt)
    fCount++
    print "File: " fCount+tab+pt+cr
    @pt+=len(pt)+1
  wend
  print cr
  print "selected " fcount " files"+cr
else
  print "no files selected"+cr
endif
wait

