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

Toast popup
Author: Message:
SourSpud
Junior Member
**

Avatar
spud, spud, spud, spoon.

Posts: 58
35 / Male / Flag
Joined: Nov 2009
O.P. RE: Toast popup
Tried that mate, this is my result.

jscript code:
//  MSN Popup Spy   by   .felipE 
//       http://felipex.net
//                Mexico, Sinaloa, Los Mochis

var PlusWnd;
var show = true;
function OnuiEvent_CtrlClicked(Wnd, ControlId){
switch (ControlId){
case "cancel":
    Interop.Call("User32", "AnimateWindow", Wnd.Handle, 180, 0x10000 | 0x80000);
    Wnd.Close(1);
    break;
case "save":
WriteRegistry("opacity",Wnd.GetControlText("wp"));
WriteRegistry("showlist", ( Boolean(Wnd.Button_IsChecked("chk")) == true ? "True" : "False") );

if ( Boolean(Wnd.Button_IsChecked("chk")) == true ){
var Box = Interop.Call("user32","FindWindowW","#32770","Msn Popup Spy Box");
if (Box) Interop.Call("user32","PostMessageA",Box,16,0,0); PlusWnd = null;
}


    Interop.Call("User32", "AnimateWindow", Wnd.Handle, 180, 0x10000 | 0x80000);

    Wnd.Close(1);
    break;

}
}

function OnuiEvent_EditTextChanged(PlusWnd, ControlId){
if ( PlusWnd.GetControlText("wp") < 0 || PlusWnd.GetControlText("wp") > 255) PlusWnd.SetControlText("wp","0");
}

function OnEvent_MenuClicked(MenuItemId,Location,OriginWnd){
switch (MenuItemId)
{
case "MnuConf":
{
PlusWnd = MsgPlus.CreateWnd("window.xml","ui");
PlusWnd.SetControlText("wp", ReadRegistry("opacity") );
PlusWnd.Button_SetCheckState("chk", ReadRegistry("showlist") );

break;
}

case "MnuAbout":
{
var Handle = (Location == 2 ? OriginWnd.Handle : Messenger.ContactListWndHandle);
Interop.Call("user32","MessageBoxW",Handle,"Created by\n    .felipE\n\n\nhttp://felipex.net\nhttp://messengeradictos.com","About MSN Popup Spy",64+4096);
//Interop.Call("shell32","ShellAboutW",Handle,"MSN Popup Spy","Created by .felipE\thttp://felipex.net",Handle);
break;
}


}
}

function OnEvent_Initialize(MessengerStart){
        PlusWnd = MsgPlus.CreateWnd("window.xml","msnbox",1);
        PlusWnd.visible=false;
        if(Messenger.MyStatus > 0){       
            OnEvent_SigninReady(Messenger.MyEmail);
        }
}

function OnEvent_SigninReady(Email){
      try     {
       var firstrun = new ActiveXObject("WScript.Shell").RegRead(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\showlist");
     }
     catch(e)     {
          WriteRegistry("opacity","200");
          WriteRegistry("showlist","False");
     }
     finally     {
        show = true;
        MsgPlus.AddTimer("msnpopupspy",100);
     }
}

function OnmsnboxEvent_Destroyed(PlusWndd,ExitCode){
show = true;
PlusWnd = null;
}

function OnEvent_Timer(TimerId){
var lngNotify = Interop.Call("user32","FindWindowW","msblpopupmsgwclass",0);
if (lngNotify)
{
var showlist = ReadRegistry("showlist");
if (showlist == "False")
{
        var c = ":";
        var d = new Date();
        var s = (d.getHours() < 10) ? "0" + d.getHours() + c : d.getHours() + c;
        s += (d.getMinutes() < 10) ? "0" + d.getMinutes() + c : d.getMinutes() + c;
        s += (d.getSeconds() < 10) ? "0" + d.getSeconds() : d.getSeconds();
       

       
        if (show){


      try     {
           PlusWnd.visible =  true;
     }
     catch(e)     {
        PlusWnd = MsgPlus.CreateWnd("window.xml","msnbox",1);
     }
     finally     {
        PlusWnd.visible = false;
        MakeWndTransparent(PlusWnd.Handle);
        show = true;
     }






        }




        PlusWnd.LstBox_AddItem("lista",s + " > " + strGettext(lngNotify));
        PlusWnd.SetControlText("lbltitle", "Notifications: " + PlusWnd.LstBox_GetCount("lista"));
}
else
{
        if (!PlusWnd)         {
        PlusWnd = MsgPlus.CreateWnd("window.xml","msnbox");
        PlusWnd.visible=false;
        show = false;
       
        }
}
       
        Interop.Call("user32","PostMessageA",lngNotify,16,0,0);
}

MsgPlus.AddTimer("msnpopupspy",100);
}

function strGettext(lngHwnd)
{
var ilngLength = Interop.Call("user32","SendMessageA",lngHwnd,14,0,0);
var strBuffer = "";
for (var x=0; x<ilngLength; x++) strBuffer+=" ";

Interop.Call("user32","SendMessageW",lngHwnd,13,ilngLength+1,strBuffer);
return(strBuffer);
}

function MakeWndTransparent(PlusWnd){
//  CODE : MSN PREVIEW BOX SCRIPT
  var Msg;
  var nMsg = Interop.Allocate(4);
  var GWL_STYLE = (-20);
  var LWA_ALPHA = 0x2;
  var WS_EX_LAYERED = 0x80000;
  var WS_EX_TRANSPARENT = 0x20;
  Msg = Interop.Call('user32', 'GetWindowLongW', PlusWnd, GWL_STYLE);
  nMsg.WriteDWORD(0, (Msg | WS_EX_LAYERED));
  Interop.Call('user32', 'SetWindowLongW', PlusWnd, GWL_STYLE, nMsg.ReadDWORD(0));
  vis = 1* ( Math.abs(ReadRegistry("opacity")) >=0 && Math.abs(ReadRegistry("opacity")) <256 ? Math.abs(ReadRegistry("opacity")) : 200);
  Interop.Call('user32', 'SetLayeredWindowAttributes', PlusWnd, 0, vis, LWA_ALPHA);
}

function WriteRegistry(key, value){
      try     {
      var toReturn = new ActiveXObject("WScript.Shell").RegWrite(MsgPlus.ScriptRegPath + Messenger.MyUserID + "\\" + key, value, "REG_SZ");
     }
     catch(e)     {
         var toReturn = 0;
     }
     finally     {
        return(toReturn);
     }
}

function ReadRegistry(key){
     try     {
      var toReturn = new ActiveXObject("WScript.Shell").RegRead(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\" + key);
     }
     catch(e)     {
      var toReturn = 0;
     }
     finally     {
        return(toReturn);
     }
}


xml code:
<Interfaces xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <Window Id="msnbox" Version="1">
        <Attributes>
            <Caption>LOL</Caption>
            <TopMost>true</TopMost>
            <ShowInTaskbar>false</ShowInTaskbar>
        </Attributes>
       
        <TitleBar>
            <AllowMinimize>false</AllowMinimize>
            <AllowMaximize>false</AllowMaximize>
            <AllowClose>false</AllowClose>
        </TitleBar>
       
        <Position Width="450" Height="60"/>
        <DialogTmpl/>
        <WindowTmpl><Corners><RoundSize>1</RoundSize></Corners><Borders><Color><Alpha>255</Alpha></Color></Borders></WindowTmpl>
        <Controls>
            <Control xsi:type="StaticControl" Id="lbltitle">
                <Position Top="1" Left="5" Width="100" Height="55"/>
                <Caption>Notifications:</Caption>
            </Control>
            <Control xsi:type="ListBoxControl" Id="lista">
                <Position Top="10" Left="5" Width="438" Height="55"/>
            </Control>
        </Controls>
    </Window>
    <Window Id="ui" Version="1">
        <Attributes>
            <Caption>Configuration</Caption>
        </Attributes>
       
        <TitleBar>

            <AllowMinimize>false</AllowMinimize>
            <AllowMaximize>false</AllowMaximize>
            <AllowClose>false</AllowClose>
            <Title><Text>Configuration</Text></Title>
        </TitleBar>
       
        <Position Width="155" Height="220"/>
        <DialogTmpl>   
            <BottomBar Style="Plain">               
                <RightControls>
                    <Control xsi:type="ButtonControl" Id="save">
                        <Position Top="0" Width="50" Left="80"/>
                        <Caption>&amp;Save</Caption>
                        <Attributes>
                            <IsDefault>true</IsDefault>
                        </Attributes>
                    </Control>
                    <Control xsi:type="ButtonControl" Id="cancel">
                        <Position Top="0" Width="50" Left="0"/>
                        <Caption>&amp;Cancel</Caption>
                    </Control>
                </RightControls>
            </BottomBar>
        </DialogTmpl>
        <WindowTmpl></WindowTmpl>
        <Elements>
            <Element xsi:type="ImageElement" Id="logo">
                <Position Top="33" Left="10"/>
                <Image><Name>buddy-floatingnickname</Name></Image>
            </Element>
        </Elements>
        <Controls>
            <Control xsi:type="StaticControl" Id="lblTitle">
                <Position Top="30" Left="30" Width="200" Height="16" />
                <Caption>MSN Popup Spy</Caption>
                <Transparency>200</Transparency>
                <Font><Bold>True</Bold><Size>16</Size></Font>
                <Attributes>
                    <AutoAdjustWidth>true</AutoAdjustWidth>
                </Attributes>
            </Control>

            <Control xsi:type="StaticControl" Id="lbltitle">
                <Position Top="45" Width="150" Left="40"/>
                <Caption>Configuration</Caption>
                <Transparency>130</Transparency>
                <Font><Bold>true</Bold><Size>7</Size></Font>
                <Attributes>
                    <AutoAdjustWidth>true</AutoAdjustWidth>
                </Attributes>
            </Control>

            <Control xsi:type="CheckBoxControl" Id="chk">
                <Position Top="115" Left="20" Width="125" Height="10"/>
                <Caption>Don't Show me the notifications' list</Caption>
            </Control>
            <Control xsi:type="StaticControl" Id="lbl02">
                <Position Top="125" Left="30" Width="80" Height="30"/>
                <Caption>Only kill Popups</Caption>
                <Transparency>160</Transparency>
            </Control>
   
       
            <Control xsi:type="StaticControl" Id="lblopacity">
                <Position Top="76" Width="150" Left="10"/>
                <Caption>Window Opacity</Caption>
                <Transparency>130</Transparency>
                <Font><Bold>true</Bold><Size>7</Size></Font>
                <Attributes>
                    <AutoAdjustWidth>true</AutoAdjustWidth>
                </Attributes>
            </Control>
            <Control xsi:type="StaticControl" Id="lblpopups">
                <Position Top="106" Width="150" Left="10"/>
                <Caption>MSN Popups</Caption>
                <Transparency>130</Transparency>
                <Font><Bold>true</Bold><Size>7</Size></Font>
                <Attributes>
                    <AutoAdjustWidth>true</AutoAdjustWidth>
                </Attributes>
            </Control>
   
       
            <Control xsi:type="EditControl" Id="wp">
                <Position Top="86" Left="20" Width="50" Heitght="11"/>
                <Attributes><NumbersOnly>true</NumbersOnly><WantReturn>true</WantReturn></Attributes>
            </Control>
            <Control xsi:type="StaticControl" Id="alpha">
                <Position Top="86" Left="73" Width="80" Height="10"/>
                <Caption>0 - 255</Caption>
                <Transparency>160</Transparency>
            </Control>
       
        </Controls>
    </Window>
</Interfaces>

Pretty sure its working bug free but it needs the .xml file to work aswell can that be removed?

This post was edited on 11-25-2009 at 10:41 AM by SourSpud.
11-25-2009 10:40 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Toast popup - by SourSpud on 11-25-2009 at 05:31 AM
RE: Toast popup - by warmth on 11-25-2009 at 05:35 AM
RE: Toast popup - by SourSpud on 11-25-2009 at 05:55 AM
RE: Toast popup - by Spunky on 11-25-2009 at 09:37 AM
RE: Toast popup - by SourSpud on 11-25-2009 at 09:43 AM
RE: Toast popup - by Spunky on 11-25-2009 at 10:27 AM
RE: Toast popup - by SourSpud on 11-25-2009 at 10:40 AM
RE: Toast popup - by Spunky on 11-25-2009 at 10:53 AM
RE: Toast popup - by SourSpud on 11-25-2009 at 10:57 AM
RE: Toast popup - by CookieRevised on 11-25-2009 at 11:41 AM
RE: Toast popup - by SourSpud on 11-25-2009 at 10:25 PM
RE: Toast popup - by Spunky on 11-25-2009 at 11:33 PM
RE: Toast popup - by SourSpud on 11-26-2009 at 01:26 AM
RE: Toast popup - by CookieRevised on 11-26-2009 at 02:17 AM
RE: Toast popup - by SourSpud on 11-26-2009 at 04:03 AM
RE: Toast popup - by CookieRevised on 11-26-2009 at 09:28 AM
RE: Toast popup - by SourSpud on 11-27-2009 at 07:17 PM


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