Shoutbox

help with GetOpenFileName - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: help with GetOpenFileName (/showthread.php?tid=72065)

help with GetOpenFileName by Dennis Mike on 02-24-2007 at 02:21 AM

hello guy's
i need use GetOpenFileName and use http://msdn2.microsoft.com/en-us/library/ms646927.aspx (OPENFILENAME)
can theys help'me with interop.allocate in openfilename?



RE: help with GetOpenFileName by Matti on 02-24-2007 at 09:34 AM

Well, it seems like you first have to construct an OPENFILENAME structure, but I found something which is easier to use in my opinion.

code:
Original code by -!Felu!-, posted at the MP!L Script Developers Rescource
function BrowseForFile(InitialDir){
BrowseFilter = "Text Files (*.txt)|*.txt|All Files|*.*";
  var BrowseDialog = new ActiveXObject("UserAccounts.CommonDialog")
  BrowseDialog.Filter = BrowseFilter;
  BrowseDialog.InitialDir = InitialDir;
  BrowseDialog.Flags = "&H4";
  BrowseDialog.ShowOpen();
  return BrowseDialog.FileName;
}
Just call the function with a initial directory path (e.g.: "C:\") and it'll open a dialog and returns the chosen path.

NOTE: This object is only available since Windows XP, but because Windows Live Messenger and Messenger Plus! Live only support XP or higher, there's no need to think of supporting pre-XP. ;)
RE: help with GetOpenFileName by Felu on 02-24-2007 at 11:59 AM

See Matty's reply to Browse For File :).


RE: help with GetOpenFileName by Matti on 02-24-2007 at 12:27 PM

quote:
Originally posted by Felu
See Matty's reply to Browse For File :).
Hmm, that one seems to be a bit more advanced, yes. :P
RE: help with GetOpenFileName by Dennis Mike on 02-24-2007 at 05:37 PM

i need get multifiles, but with this activex if i use thist flags 0x80200, i can select multifile, but no get the patch the file, single the folder that it contains them