What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Browse Help

Browse Help
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Browse Help
Oops I made a mistake!

code:
var OFN_ENABLESIZING = 0x800000;
var OFN_EXPLORER = 0x80000;
var OFN_FILEMUSTEXIST = 0x1000;
var OFN_HIDEREADONLY = 0x4;
var OFN_LONGNAMES = 0x200000;
var OFN_PATHMUSTEXIST = 0x800;
var OFN_OVERWRITEPROMPT = 0x00000002;

function BrowseForFile(sTitle){
    var OpenFileName = Interop.Allocate(88);
    var filter = '*';
    var s_filter;
    var s_file;
    var file = '*.*';
    var title;
    var s_title;
    var ret;
    var initdir = 'c:\\';
    var s_initdir = Interop.Allocate((initdir.length+1)*2);
    s_initdir.WriteString(0, initdir);
   
    with (OpenFileName){
        WriteDWORD(0, Size);
        s_filter = Interop.Allocate((filter.length+1)*2);
        s_filter.WriteString(0, filter);
        WriteDWORD(12, s_filter.DataPtr);
        WriteDWORD(24, 1);
        s_file = Interop.Allocate((255+1)*2);
        s_file.WriteString(0, file)
        WriteDWORD(28, s_file.DataPtr);
        WriteDWORD(32, 255);
        var sTmp = Interop.Allocate((254+1)*2);
        WriteDWORD(36, sTmp.DataPtr);
        WriteDWORD(40, 255);
        WriteDWORD(44, s_initdir.DataPtr);
        s_title = Interop.Allocate((sTitle.length+1)*2);
        WriteDWORD(48, s_title.DataPtr);
        WriteDWORD(52, OFN_ENABLESIZING | OFN_EXPLORER | OFN_HIDEREADONLY | OFN_LONGNAMES | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_OVERWRITEPROMPT);
    }
    ret = Interop.Call('comdlg32.dll', 'GetSaveFileNameW', OpenFileName);
    if (ret != 0) {
        return s_file.ReadString(0);
    }
}

//Usage

    Debug.Trace(BrowseForFolder('Pick a file'));
10-15-2006 11:36 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Browse Help - by TYL3R on 10-15-2006 at 07:03 PM
RE: Browse Help - by matty on 10-15-2006 at 09:37 PM
RE: Browse Help - by TYL3R on 10-15-2006 at 10:23 PM
RE: Browse Help - by deAd on 10-15-2006 at 10:54 PM
RE: Browse Help - by Ezra on 10-15-2006 at 11:08 PM
RE: Browse Help - by TYL3R on 10-15-2006 at 11:18 PM
RE: Browse Help - by matty on 10-15-2006 at 11:25 PM
RE: Browse Help - by TYL3R on 10-15-2006 at 11:31 PM
RE: Browse Help - by matty on 10-15-2006 at 11:36 PM
RE: Browse Help - by TYL3R on 10-16-2006 at 01:03 AM
RE: Browse Help - by deAd on 10-16-2006 at 02:15 AM
RE: Browse Help - by matty on 10-16-2006 at 03:45 AM
RE: Browse Help - by TYL3R on 10-16-2006 at 04:05 AM
RE: Browse Help - by roflmao456 on 01-18-2007 at 01:08 PM
RE: Browse Help - by TYL3R on 01-19-2007 at 03:36 AM
RE: Browse Help - by Felu on 01-19-2007 at 10:27 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On