What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Font Dialog - Enhanced Colour

Font Dialog - Enhanced Colour
Author: Message:
Dempsey
Scripting Contest Winner
*****

Avatar
http://AdamDempsey.net

Posts: 2395
Reputation: 53
38 / Male / Flag
Joined: Jul 2003
O.P. RE: Font Dialog - Enhanced Colour
I'm guessing it's probably because I don't set some parts of the CHOOSEFONT structure correctly, here's the code I use:
code:
function ChooseFont(){
    var CF = Interop.Allocate(60);
    CF.WriteDWORD(0, CF.Size); //lStructSize
    CF.WriteDWORD(4, 0); //hwndOwner
    CF.WriteDWORD(8, 0); //hDC
    var LF = Interop.Allocate(92);
    LF.WriteDWORD(0,0); //lfHeight
    LF.WriteDWORD(4,0); //lfWidth
    LF.WriteDWORD(8,0); //lfEscapement
    LF.WriteDWORD(12,0); //lfOrientation
    LF.WriteDWORD(16,0); //lfWeight
    LF.SetAt(20,0); //lfItalic
    LF.SetAt(21,0); //lfUnderline
    LF.SetAt(22,0); //lfStrikethru
    LF.SetAt(23,0); //lfCharSet
    LF.SetAt(24,0); //lfOutPrecision
    LF.SetAt(25,0); //lfClipPrecision
    LF.SetAt(26,0); //lfQuality
    LF.SetAt(27,0); //lfPitchAndFamily
    LF.WriteString(28, ""); // lfFaceName
    CF.WriteDWORD(12, LF.DataPtr); //LPLF
    var iPointSize = Interop.Allocate(4);
    CF.WriteDWORD(16, iPointSize.DataPtr); //iPointSize
    CF.WriteDWORD(20, CF_INITTOLFSTRUCT | CF_SCREENFONTS | CF_EFFECTS ); //Flags
    CF.WriteDWORD(24, 0); // rgbColors
    CF.WriteDWORD(28, 0); // lCustData
    CF.WriteDWORD(32, 0); // lpfnHook
    CF.WriteDWORD(36, 0); // lpTemplateName
    CF.WriteDWORD(40, 0); // hInstance
    var lpszStyle = Interop.Allocate(514);
    CF.WriteDWORD(44, lpszStyle.DataPtr); // lpszStyle
    CF.WriteWORD(48, 0x2000); // nFontType
    CF.WriteDWORD(50, 0); // nSizeMin
    CF.WriteDWORD(54, 0); // nSizeMax
    var result = Interop.Call("comdlg32.dll", "ChooseFontW", CF);
        if(result > 0){
                Debug.Trace('Font: ' + LF.ReadString(28));
                Debug.Trace('Size: ' + LF.ReadDWORD( 0));
                //var weight = LF.ReadDWORD(16);
                if (LF.ReadDWORD(16) == 700){
                        Debug.Trace('Bold: 1');
                }else{
                        Debug.Trace('Bold: 0');
                }
                Debug.Trace('Italic: ' +LF.GetAt(20));
                Debug.Trace('Underline: ' + LF.GetAt(21));
                Debug.Trace('Strkethru: ' + LF.GetAt(22));
        }else{
                var error = Interop.Call('ComDlg32', 'CommDlgExtendedError');
                if(error > 0){
            LF.WriteDWORD(0,0);
                        //An error occurred, "error" contains the error code
                }else{
            LF.WriteDWORD(0,0);
                        //User closed font dialog
                }
        }
    return LF;
}
SoundPacks   -   Scripts   -   Skins

that's not a bug, thats an unexpected feature
08-13-2006 01:32 AM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Font Dialog - Enhanced Colour - by Dempsey on 08-07-2006 at 10:57 AM
RE: Font Dialog - Enhanced Colour - by Patchou on 08-12-2006 at 05:40 PM
RE: Font Dialog - Enhanced Colour - by Dempsey on 08-13-2006 at 01:32 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