What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » UserAccounts.CommonDialog alternative for Vista

UserAccounts.CommonDialog alternative for Vista
Author: Message:
Guena
Full Member
***

Avatar

Posts: 102
Reputation: 5
44 / Male / Flag
Joined: Nov 2008
O.P. UserAccounts.CommonDialog alternative for Vista
First of all my Script is made to allow anybody to add his own picture to backgrounds available in my Skin "Avalon Concept 2009"

I use the following code to browse for a file: (come from the script "Backround Adder" and used with authorisation)

code:
function OnBackgroundWndenEvent_CtrlClicked(pPlusWnd, sControlId) {
    var FSO = new ActiveXObject("Scripting.FileSystemObject");
    var sourceFile = pPlusWnd.GetControlText('EdtFrom').replace(/(^\s*)|(\s*$)/g, '');
    switch (sControlId) {
        case 'BtnLoc':
            var oOpenDlg = new ActiveXObject('UserAccounts.CommonDialog');
            oOpenDlg.FileName = sourceFile;
            oOpenDlg.Filter =    'All Pictures|*.BMP;*.DIB;*.EMF;*.GIF;*.ICO;*.JPG;*.JPEG;*.JPE;*.JFIF;*.JIF;*.PNG;*.RLE;*.TIF;*.TIFF;*.WMF;|'
                        +    'All Files (*.*)|*.*|'
                        +    'Bitmaps (*.BMP)|*.BMP|'
                        +    'JPEG (*.JPG;*.JPEG)|*.JPG;*.JPEG|'
                        +    'Portable Network Graphics (*.PNG)|*.PNG|';
            oOpenDlg.FilterIndex = (oOpenDlg.FileName === '' || oOpenDlg.Filter.indexOf("." + FSO.GetExtensionName(oOpenDlg.FileName).toUpperCase() + ';') !== -1) ? 1 : 2;
            oOpenDlg.Flags = 0x1000 | 0x800 | 0x4;
            oOpenDlg.ShowOpen();
            pPlusWnd.SetControlText('EdtFrom', (oOpenDlg.FileName === '') ? '' : FSO.GetAbsolutePathName(oOpenDlg.FileName));
            break;
        case 'BtnOk':
            AddBackground(sourceFile);   
            pPlusWnd.Close(1);
            break;
        case 'BtnAbout':
            MsgPlus.CreateWnd('BackgroundAdder.xml', 'AboutWnden');
            pPlusWnd.Close(1);
            break;
    }
}

but it works only on XP not on vista, could someone please help me?

Thanks

This post was edited on 01-19-2009 at 11:43 PM by Guena.
01-19-2009 11:21 PM
Profile PM Find Quote Report
ArkaneArkade
Full Member
***

Avatar
The One and Only

Posts: 193
Reputation: 5
39 / Male / Flag
Joined: Mar 2007
RE: UserAccounts.CommonDialog alternative for Vista
Would actually quite like to know this myself.  Seems quite a few scripts don't work on vista anymore because of this (well, work, but with obvious failures).

Is there any alternative method that will either work on both XP and Vista, or else just a vista alternative so that some scripts could be updated.

- I'd settle for any pointers of a script with it, happy to learn through another.
[Image: adsig.jpg]
01-20-2009 08:32 PM
Profile E-Mail PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: UserAccounts.CommonDialog alternative for Vista
Don't use ActiveXObjects as they can be system dependent?!?

Use GetOpenFileName and the structure OPENFILENAME

[edit]

Yay for searching the forums...

Matti's reply to CommonDialog help

[/edit]

This post was edited on 01-21-2009 at 01:41 PM by matty.
01-20-2009 09:01 PM
Profile E-Mail PM Find Quote Report
Guena
Full Member
***

Avatar

Posts: 102
Reputation: 5
44 / Male / Flag
Joined: Nov 2008
O.P. RE: RE: UserAccounts.CommonDialog alternative for Vista
quote:
Originally posted by matty
Don't use ActiveXObjects as they can be system dependent?!?

Use GetOpenFileName and the structure OPENFILENAME

[edit]

Yay for searching the forums...

Matti's reply to CommonDialog help

[/edit]

Thank you very much, it should be OK for me now
01-22-2009 12:11 AM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: UserAccounts.CommonDialog alternative for Vista
The UserAccounts.CommonDialog ActiveX does not work anymore in Vista. You have two choices:

Either replace it with MSComDlg.CommonDialog. But the MSComDlg.CommonDialog ActiveX will only work if you have a design license for it (you'll have that when you have installed stuff like MSOffice, Visual Studio, VB, ...). So it usually will work, but it might not on all systems.

Or do as Matty suggested and use the GetOpenFileName API.
(recommended method)

This post was edited on 11-07-2009 at 04:22 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
11-07-2009 03:55 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


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