What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » WLM Plus! General » Force Plus to load

Force Plus to load
Author: Message:
Patchou
Messenger Plus! Creator
*****

Avatar

Posts: 8607
Reputation: 201
43 / Male / Flag
Joined: Apr 2002
RE: Force Plus to load
lol... you're right, here is the code :p. I think you found out pretty much everythign anyway. As for "HandleMessengerStart" it's just here as a user setting (how did you know about it? I don't remember giving this information publicly :). I added it in case someone wouldn't want Plus! to create it's own /Winstart key for some obscure technical reason.

code:
//
///////////////////////////////////////////////////////////////
void CMsgPlusUtilWnd::PreventAutoMessengerStart()
{
    try
    {
        TRACE("CMsgPlusUtilWnd::PreventAutoMessengerStart - called");

        //Removes Messenger from Windows starts and remember the command lines
        CRegKey reg;
        if(reg.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Run")) == ERROR_SUCCESS)
        {
            TCHAR sPath[1024]; sPath[0] = '\0';
            ULONG nSize = 1024;
            reg.QueryStringValue(CPreferences::GetMessengerVersion() < 5 ? _T("MSMSGS") : _T("msnmsgr"), sPath, &nSize);
            reg.DeleteValue(_T("MessengerPlus2")); //Delete the old value

            CRegKey regMP;
            regMP.Create(HKEY_CURRENT_USER, _T("Software\\Patchou\\MsgPlus2"));
           
            DWORD nEnable = 1;
            regMP.QueryDWORDValue(_T("HandleMessengerStart"), nEnable);
            if(nEnable)
            {
                //First, check if we can do something here
                regMP.QueryDWORDValue(_T("HandleMessengerStart"), nEnable);
                if(sPath[0] == '\0')
                {
                    TCHAR sMPPath[1024]; sMPPath[0] = '\0';
                    DWORD nSize = 1024;
                    regMP.QueryStringValue(CPreferences::GetMessengerVersion() < 5 ? _T("AutoMsg4Start") : _T("AutoMsg5Start"), sMPPath, &nSize);
                    if(sMPPath[0] == '\0')
                        return;
                }

                //Check if Messenger is set to start automatically
                bool bMessengerStart = false;

                CRegKey regAdmin;
                DWORD nNotAdminMode = FALSE;
                if(regAdmin.Open(HKEY_CURRENT_USER, _T("Software\\Patchou\\MsgPlus2"), KEY_READ) == ERROR_SUCCESS)
                {
                    regAdmin.QueryDWORDValue(_T("NotAdminMode"), nNotAdminMode);
                    regAdmin.Close();
                }

                if(!nNotAdminMode)
                {
                    if(CPreferences::GetMessengerVersion() < 5)
                    {
                        CRegKey reg;
                        if(reg.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\MessengerService")) == ERROR_SUCCESS)
                        {
                            DWORD nAppSettings = 0;
                            reg.QueryDWORDValue(_T("AppSettings"), nAppSettings);
                            if(nAppSettings & 0x200)
                                bMessengerStart = true;
                        }
                    }
                    else
                    {
                        CRegKey reg;
                        if(reg.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\MSNMessenger")) == ERROR_SUCCESS)
                        {
                            DWORD nAppSettings = 0;
                            reg.QueryDWORDValue(_T("AppSettings"), nAppSettings);
                            if(nAppSettings & 0x200)
                                bMessengerStart = true;
                        }
                    }
                }

                //Add or remove our MP start value?
                if(bMessengerStart)
                {
                    //Add a special Messenger Plus! command line
                    string sMPCmdLine = _T("\"");
                    sMPCmdLine += CPreferences::GetMessengerPlusBinDir();
                    sMPCmdLine += _T("\\");
                    sMPCmdLine += CPreferences::GetMsgPlusExeName();
                    sMPCmdLine += _T("\" /WinStart");
                    reg.SetStringValue(_T("MessengerPlus3"), sMPCmdLine);

                    //Remember the path
                    if(sPath[0] != '\0')
                        regMP.SetStringValue(CPreferences::GetMessengerVersion() < 5 ? _T("AutoMsg4Start") : _T("AutoMsg5Start"), sPath);
                    reg.DeleteValue(CPreferences::GetMessengerVersion() < 5 ? _T("MSMSGS") : _T("msnmsgr"));
                }
                else
                    regMP.DeleteValue(CPreferences::GetMessengerVersion() < 5 ? _T("AutoMsg4Start") : _T("AutoMsg5Start"));
            }
            else
                reg.DeleteValue(_T("MessengerPlus3"));
        }
        TRACE("CMsgPlusUtilWnd::PreventAutoMessengerStart - exited");
    }
    catch(...)
    {
        TRACE("An exception was thrown in CMsgPlusUtilWnd::PreventAutoMessengerStart");
    }
}
[Image: signature2.gif]
08-11-2004 05:50 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Force Plus to load - by lopardo on 08-07-2004 at 08:59 PM
RE: Force Plus to load - by Ezra on 08-07-2004 at 09:02 PM
RE: Force Plus to load - by lopardo on 08-07-2004 at 09:14 PM
RE: Force Plus to load - by Ezra on 08-07-2004 at 09:15 PM
RE: Force Plus to load - by lopardo on 08-07-2004 at 09:21 PM
RE: Force Plus to load - by CookieRevised on 08-09-2004 at 03:17 PM
RE: Force Plus to load - by Patchou on 08-09-2004 at 05:04 PM
RE: Force Plus to load - by cooldude_i06 on 08-09-2004 at 06:24 PM
RE: Force Plus to load - by CookieRevised on 08-10-2004 at 03:04 AM
RE: Force Plus to load - by Patchou on 08-10-2004 at 07:05 AM
RE: Force Plus to load - by CookieRevised on 08-10-2004 at 10:07 AM
RE: Force Plus to load - by lopardo on 08-10-2004 at 09:17 PM
RE: Force Plus to load - by CookieRevised on 08-11-2004 at 01:32 PM
RE: Force Plus to load - by CookieRevised on 08-11-2004 at 05:02 PM
RE: Force Plus to load - by Patchou on 08-11-2004 at 05:50 PM
RE: Force Plus to load - by Dempsey on 08-11-2004 at 06:47 PM
RE: Force Plus to load - by Choli on 08-11-2004 at 09:06 PM
RE: Force Plus to load - by lopardo on 08-12-2004 at 04:44 AM
RE: Force Plus to load - by CookieRevised on 08-12-2004 at 08:38 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