<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Aus einem sichtbaren Fenster kann kein modales gemacht werden]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich habe einen ganz kuriosen Fehler:</p>
<p>Ich habe eine Anwendung, die beim Klicken auf Beenden ein Auswahlfenster aufruft: Programm beenden oder Windows herunterfahren.<br />
Wenn ich &quot;Programm beenden&quot; anwähle, schließt sich die Anwendung wie gewollt. Wähle ich &quot;Windows herunterfahren&quot;, dann erscheint die Meldung &quot;Aus einem sichtbaren Fenster kann kein modales gemacht werden&quot;. Ich habe aber im Quellcodeabschnitt zum Herunterfahren keinen Aufruf &quot;ShowModal()&quot;. Hier nochmal ein Codeausschnitt:</p>
<pre><code class="language-cpp">if (RadioButton_ProgEnd-&gt;Checked == true)
    {
        Form_Passwd-&gt;ShowModal();
        Close();
    }
    else
    {
        int button = Application-&gt;MessageBox(Form_Main-&gt;AS_MeldungBeenden[1].c_str(), Application-&gt;Title.c_str(), MB_YESNO+MB_ICONQUESTION);
        if (button == IDYES)
        {
            Form_Main-&gt;SchreibeIniFile();

            HANDLE hToken;
            TOKEN_PRIVILEGES tkp;

            // Get a token for this process.
            if (!OpenProcessToken(GetCurrentProcess(),
                TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &amp;hToken));

            // Get the LUID for the shutdown privilege.
            LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
                &amp;tkp.Privileges[0].Luid);

            tkp.PrivilegeCount = 1;  // one privilege to set
            tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

            // Get the shutdown privilege for this process.
            AdjustTokenPrivileges(hToken, FALSE, &amp;tkp, 0,
                (PTOKEN_PRIVILEGES)NULL, 0);

            // Shut down the system and force all applications to close.
            if (!ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCE, 0));
        }
        else
        {
            Close();
        }
    }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/163112/aus-einem-sichtbaren-fenster-kann-kein-modales-gemacht-werden</link><generator>RSS for Node</generator><lastBuildDate>Tue, 11 Aug 2026 23:03:35 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/163112.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 26 Oct 2006 08:15:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Aus einem sichtbaren Fenster kann kein modales gemacht werden on Thu, 26 Oct 2006 08:15:45 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich habe einen ganz kuriosen Fehler:</p>
<p>Ich habe eine Anwendung, die beim Klicken auf Beenden ein Auswahlfenster aufruft: Programm beenden oder Windows herunterfahren.<br />
Wenn ich &quot;Programm beenden&quot; anwähle, schließt sich die Anwendung wie gewollt. Wähle ich &quot;Windows herunterfahren&quot;, dann erscheint die Meldung &quot;Aus einem sichtbaren Fenster kann kein modales gemacht werden&quot;. Ich habe aber im Quellcodeabschnitt zum Herunterfahren keinen Aufruf &quot;ShowModal()&quot;. Hier nochmal ein Codeausschnitt:</p>
<pre><code class="language-cpp">if (RadioButton_ProgEnd-&gt;Checked == true)
    {
        Form_Passwd-&gt;ShowModal();
        Close();
    }
    else
    {
        int button = Application-&gt;MessageBox(Form_Main-&gt;AS_MeldungBeenden[1].c_str(), Application-&gt;Title.c_str(), MB_YESNO+MB_ICONQUESTION);
        if (button == IDYES)
        {
            Form_Main-&gt;SchreibeIniFile();

            HANDLE hToken;
            TOKEN_PRIVILEGES tkp;

            // Get a token for this process.
            if (!OpenProcessToken(GetCurrentProcess(),
                TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &amp;hToken));

            // Get the LUID for the shutdown privilege.
            LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
                &amp;tkp.Privileges[0].Luid);

            tkp.PrivilegeCount = 1;  // one privilege to set
            tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

            // Get the shutdown privilege for this process.
            AdjustTokenPrivileges(hToken, FALSE, &amp;tkp, 0,
                (PTOKEN_PRIVILEGES)NULL, 0);

            // Shut down the system and force all applications to close.
            if (!ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCE, 0));
        }
        else
        {
            Close();
        }
    }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1161653</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161653</guid><dc:creator><![CDATA[Linde]]></dc:creator><pubDate>Thu, 26 Oct 2006 08:15:45 GMT</pubDate></item></channel></rss>