Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Аватара для Котяра

Ветеран


Сообщения: 2907
Благодарности: 331

Профиль | Отправить PM | Цитировать


Не знаю, в тему ли пишу, но вот это код функции деинсталляции программы TweakUI, встроенный в ее исполняемый файл. Извлек программой "Ресторатор":
Код: Выделить весь код
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" 
    "http://www.w3.org/TR/html4/loose.dtd">
<HTML RTL=1>
<HEAD>
<TITLE>Uninstalling Tweak UI</TITLE>
<HTA:APPLICATION
    APPLICATIONNAME="uninstallTweakUI"
    _BORDER="dialog"
    CONTEXTMENU="no"
    INNERBORDER="no"
    MAXIMIZEBUTTON="no"
    MINIMIZEBUTTON="no"
    SCROLL="no"
    SELECTION="no"
    SINGLEINSTANCE="yes"
 />
<STYLE>
HTML {
    background-color: threedface; color: buttontext;
    font-family: Tahoma; font-size: 10pt;
}
LI { list-style-type: none }
}
</STYLE>
</HEAD>
<SCRIPT LANGUAGE="JScript" DEFER>
var FSO;
var WshShell;
var c_msDelay = 50; // intentionally slow down so people can watch
var g_cTasks;
var g_iCur;
var c_keyPath = 

"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Tweak 

UI 2.10\\";

function beginUninstall()
{
    oIntro.style.display = "none";
    oProgress.style.display = "block";
    FSO = new ActiveXObject("Scripting.FileSystemObject");
    WshShell = new ActiveXObject("WScript.Shell");
    g_cTasks = document.all.tags("LI");
    g_iCur = 0;
    window.setTimeout(startAction, c_msDelay);
}

function startAction()
{
    g_cTasks[g_iCur].style.listStyleType = "disc";
    window.setTimeout(performAction, c_msDelay);
}

function performAction()
{
    if (eval(g_cTasks[g_iCur]._action)) {
        g_iCur++;
        if (g_iCur < g_cTasks.length) {
            window.setTimeout(startAction, c_msDelay);
        }
    }
}

function deleteShortcut()
{
    var pathShortcut;
    try {
        pathShortcut = WshShell.RegRead(c_keyPath + "ShortcutPath");
    } catch (e) {
        return true; // key doesn't exist - nothing to delete
    }

    // Delete shortcut if present - keep going on failure
    try { FSO.DeleteFile(pathShortcut); } catch (e) { }

    // Delete folder if empty - keep going on failure
    var pathFolder = FSO.GetParentFolderName(pathShortcut);
    if (FSO.GetFolder(pathFolder).Files.Count == 0) {
        try { FSO.DeleteFolder(pathFolder); } catch (e) { }
    }

    return true;
}

function deleteUninstall()
{
    //  Ignore failure
    try { WshShell.RegDelete(c_keyPath); } catch (e) { }
    return true;
}

var g_nTries = 0;

function deleteFiles()
{
    var ss = (window.location + "").split("/");
    if (ss.length == 4 && ss[0] == "res:") {
    } else {
        alert("Unable to location installed copy of Tweak UI.");
        window.close();
        return false;
    }

    var pathSelf = ss[2];

    try {
        FSO.DeleteFile(FSO.GetParentFolderName(pathSelf) +
                       "\\PowerToysLicense.rtf");
    } catch (e) { }

    var fSuccess = false;
    try { FSO.DeleteFile(pathSelf); fSuccess = true; }
    catch (e) {
        if (e.number == -2146828218 && ++g_nTries < 5) {
            window.setTimeout(startAction, 250);
            return false;   // wait and try again
        }
    };

    if (g_nTries >= 5) {
        alert("Unable to delete Tweak UI.  Make sure no copies of Tweak 

UI are running.");
        window.close();
        return false;
    }

    if (!fSuccess) {
        alert("Unable to delete Tweak UI.  " + e.message);
        window.close();
        return false;
    }

    return true;
}

function reportFinished()
{
    g_cTasks[g_iCur].style.display = "list-item";
    oClose.focus();
    return true;
}
</SCRIPT>

<BODY onload=oCancel.focus()>
<DIV ID=oContent STYLE="position: absolute; height: 11em; width: 

20em"></DIV>
<SCRIPT LANGUAGE="JScript">
    window.resizeTo(oContent.offsetWidth,oContent.offsetHeight);
</SCRIPT>
<TABLE ID=oIntro>
<TR><TD>Click the "Uninstall" button to uninstall Tweak UI.</TD></TR>
<TR><TD ALIGN=right><BUTTON onclick=beginUninstall()>Uninstall</BUTTON>
 <BUTTON ID=oCancel onclick=window.close()>Cancel</BUTTON>
</TR></TD>
</TABLE>
<UL ID=oProgress STYLE="display:none; margin-bottom: 0pt">
<LI _action=deleteShortcut()>Deleting Start menu icon
<LI _action=deleteUninstall()>Deleting uninstall information
<LI _action=deleteFiles()>Deleting files
<LI _action=reportFinished() style="display:none">Done
<DIV ALIGN=right><BUTTON ID=oClose 

onclick=window.close()>Close</BUTTON></DIV>
</UL>
</BODY>
</HTML>
Если кому нужно - изучайте. Это *.hta

Отправлено: 16:49, 07-01-2009 | #566