<?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[Form2-&amp;gt;Close(); funktioniert nicht]]></title><description><![CDATA[<p>Hi. Folgender Code:</p>
<pre><code class="language-cpp">void __fastcall TForm2::FormActivate(TObject *Sender)
{    
      //do something

     if(ListBox2-&gt;Count == 0)   //Wenn keine neuen Dateien gefunden -&gt; MessageBox anzeigen und Fenster schließen
        {
        Application-&gt;MessageBox(&quot;Keine neuen Dateien gefunden!&quot;, &quot;Nothing found&quot;,  MB_RETRYCANCEL);
        Form2-&gt;Close();
        }
     else
        {
        Label2-&gt;Caption = &quot;Suche abgeschlossen&quot;; //Meldung das Suche abgeschlossen
        Label4-&gt;Caption = ListBox2-&gt;Count;  //Gefundene Dateien anzeigen
        }

}
</code></pre>
<p>Wenn die if-Anweisung true ist öffnet er zwar die MessageBox aber er schliesst das Fenster Form2 nicht. Woran kann das liegen?</p>
<p>Gruß Alex</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/185362/form2-gt-close-funktioniert-nicht</link><generator>RSS for Node</generator><lastBuildDate>Sun, 16 Aug 2026 09:45:35 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/185362.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 24 Jun 2007 17:28:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Form2-&amp;gt;Close(); funktioniert nicht on Sun, 24 Jun 2007 17:28:50 GMT]]></title><description><![CDATA[<p>Hi. Folgender Code:</p>
<pre><code class="language-cpp">void __fastcall TForm2::FormActivate(TObject *Sender)
{    
      //do something

     if(ListBox2-&gt;Count == 0)   //Wenn keine neuen Dateien gefunden -&gt; MessageBox anzeigen und Fenster schließen
        {
        Application-&gt;MessageBox(&quot;Keine neuen Dateien gefunden!&quot;, &quot;Nothing found&quot;,  MB_RETRYCANCEL);
        Form2-&gt;Close();
        }
     else
        {
        Label2-&gt;Caption = &quot;Suche abgeschlossen&quot;; //Meldung das Suche abgeschlossen
        Label4-&gt;Caption = ListBox2-&gt;Count;  //Gefundene Dateien anzeigen
        }

}
</code></pre>
<p>Wenn die if-Anweisung true ist öffnet er zwar die MessageBox aber er schliesst das Fenster Form2 nicht. Woran kann das liegen?</p>
<p>Gruß Alex</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312907</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312907</guid><dc:creator><![CDATA[AlexDozer]]></dc:creator><pubDate>Sun, 24 Jun 2007 17:28:50 GMT</pubDate></item><item><title><![CDATA[Reply to Form2-&amp;gt;Close(); funktioniert nicht on Sun, 24 Jun 2007 17:43:32 GMT]]></title><description><![CDATA[<p>Das Programm wartet bis die MessageBox bestätigt wurde und führt erst danach den folgenden Code (Form-&gt;Close) aus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312917</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312917</guid><dc:creator><![CDATA[Rostfrei**]]></dc:creator><pubDate>Sun, 24 Jun 2007 17:43:32 GMT</pubDate></item><item><title><![CDATA[Reply to Form2-&amp;gt;Close(); funktioniert nicht on Sun, 24 Jun 2007 17:59:16 GMT]]></title><description><![CDATA[<p>Hi Rostfrei!</p>
<p>Daran liegt es leider nicht. Hatte das auch schon andersrum:</p>
<pre><code class="language-cpp">Form2-&gt;Close();
Application-&gt;MessageBox(&quot;Keine neuen Dateien gefunden!&quot;, &quot;Nothing found&quot;,  MB_RETRYCANCEL);
</code></pre>
<p>Und da ist es genau dasselbe. Kann es vielleicht daran liegen das es im Ereigniss OnActivate liegt???</p>
<p>Gruß Alex</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312929</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312929</guid><dc:creator><![CDATA[AlexDozer]]></dc:creator><pubDate>Sun, 24 Jun 2007 17:59:16 GMT</pubDate></item><item><title><![CDATA[Reply to Form2-&amp;gt;Close(); funktioniert nicht on Sun, 24 Jun 2007 18:08:07 GMT]]></title><description><![CDATA[<p>Das Ereignis OnActivate kann nicht der Grund sein. Eventuell hast Du weiteren Code in OnClose/OnCloseQuery, der das Schließen des Fensters verhindert?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312932</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312932</guid><dc:creator><![CDATA[Rostfrei**]]></dc:creator><pubDate>Sun, 24 Jun 2007 18:08:07 GMT</pubDate></item><item><title><![CDATA[Reply to Form2-&amp;gt;Close(); funktioniert nicht on Sun, 24 Jun 2007 18:20:31 GMT]]></title><description><![CDATA[<p>Also ich denke es liegt daran, daß 'Form2-&gt;Close();' in 'TForm2::FormActivate' ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312936</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312936</guid><dc:creator><![CDATA[OldMan00]]></dc:creator><pubDate>Sun, 24 Jun 2007 18:20:31 GMT</pubDate></item><item><title><![CDATA[Reply to Form2-&amp;gt;Close(); funktioniert nicht on Sun, 24 Jun 2007 18:22:05 GMT]]></title><description><![CDATA[<p>Ausser in OnActivate und OnPaint ist sonst nirgendswo was drin. Und das in OnPaint hab ich grad mal schnell auskommentiert ohne Erfolg</p>
<p>Ich poste mal den ganzen Block:</p>
<pre><code class="language-cpp">void __fastcall TForm2::FormActivate(TObject *Sender)
{

     char found[1000];
     AnsiString lpOutput;
     AnsiString gaense = &quot;\&quot;&quot;;
     lpOutput = &quot;find.bat &quot; + gaense + (AnsiString)dir + gaense + &quot; &gt; find.txt&quot;;

     STARTUPINFO si1;
     PROCESS_INFORMATION pi1;

     ZeroMemory( &amp;si1, sizeof(si1) );
     ZeroMemory( &amp;pi1, sizeof(pi1) );

     si1.cb = sizeof(si1);
     si1.dwFlags = STARTF_USESHOWWINDOW;
     si1.wShowWindow = SW_HIDE;

     //Starten des externen Suchprogramms
     CreateProcess(NULL,lpOutput.c_str(),NULL,NULL,false,NULL,NULL,NULL,&amp;si1,&amp;pi1);
     SetThreadPriority(pi1.hThread,-2);
     WaitForSingleObject( pi1.hProcess, INFINITE);

     //find.txt öffnen zum Einlesen der gefundenen Dateien
     fstream Datei;
     Datei.open (&quot;find.txt&quot;);

     //Zeile für Zeile auslesen und in Datenbank überprüfen ob vorhanden
     while (Datei.getline(found, 1000))
        {

        string stringfound = found;

        //Backslashs für Datenbank-Abfrage verdoppeln
        while ((pos = stringfound.find (&quot;\\&quot;, pos+1)) != string::npos)
                {
                stringfound.insert (pos, &quot;\\&quot;);
                pos = pos + 2 ;
                }
        pos = 0;

        //Hochkommas für Datenbank-Abfrage verdoppeln
        while ((pos = stringfound.find (&quot;'&quot;, pos+1)) != string::npos)
                {
                stringfound.insert (pos, &quot;'&quot;);
                pos = pos + 1 ;
                }

        AnsiString Fund = stringfound.c_str();
        Form1-&gt;ADOQuery1-&gt;Close();
	    Form1-&gt;ADOQuery1-&gt;SQL-&gt;Clear();
        Form1-&gt;ADOQuery1-&gt;SQL-&gt;Add(&quot;SELECT * FROM musik WHERE Pfad = '&quot;+Fund+&quot;' &quot;);
        Form1-&gt;ADOQuery1-&gt;Open();

        //Abfragen ob Treffer für den Pfad vorhanden sind
        if(Form1-&gt;ADOQuery1-&gt;IsEmpty() )
        	ListBox2-&gt;AddItem(found,NULL);    //Wenn kein Treffer vorhanden Pfad in der ListBox eintragen
        }
     Datei.clear();
     Datei.close();

     if(ListBox2-&gt;Count == 0)   //Wenn keine neuen Dateien gefunden -&gt; MessageBox anzeigen und Fenster schließen
        {
        Form2-&gt;Close();
        Application-&gt;MessageBox(&quot;Keine neuen Dateien gefunden!&quot;, &quot;Nothing found&quot;,  MB_RETRYCANCEL);
        }
     else
        {
        Label2-&gt;Caption = &quot;Suche abgeschlossen&quot;; //Meldung das Suche abgeschlossen
        Label4-&gt;Caption = ListBox2-&gt;Count;  //Anzahl der gefundenen Dateien anzeigen
        }

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1312937</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312937</guid><dc:creator><![CDATA[AlexDozer]]></dc:creator><pubDate>Sun, 24 Jun 2007 18:22:05 GMT</pubDate></item><item><title><![CDATA[Reply to Form2-&amp;gt;Close(); funktioniert nicht on Sun, 24 Jun 2007 18:28:40 GMT]]></title><description><![CDATA[<p>^^ Dann teste es dochmal. Bei mir funktioniert das problemlos.</p>
<p>//Edit:<br />
Kommentier mal alles vor der letzten If-Abfrage aus. Dann sollte es eigentlich funktionieren. Will heißen, das Problem liegt vorher. Du schließt die Datenbank z.B. nicht mit Close...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312938</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312938</guid><dc:creator><![CDATA[Rostfrei**]]></dc:creator><pubDate>Sun, 24 Jun 2007 18:28:40 GMT</pubDate></item><item><title><![CDATA[Reply to Form2-&amp;gt;Close(); funktioniert nicht on Sun, 24 Jun 2007 18:29:53 GMT]]></title><description><![CDATA[<p>Ich hab das ganze jetzt mal bei OnPaint reingeworfen. Jetzt ist es zumindest schon mal so das wenn ich die MessageBox schliesse das Fenster auch zugeht. Das war bei OnActivate nicht so.</p>
<p>Zumindest schon mal eine Verbesserung <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312943</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312943</guid><dc:creator><![CDATA[AlexDozer]]></dc:creator><pubDate>Sun, 24 Jun 2007 18:29:53 GMT</pubDate></item><item><title><![CDATA[Reply to Form2-&amp;gt;Close(); funktioniert nicht on Sun, 24 Jun 2007 18:32:26 GMT]]></title><description><![CDATA[<p>Rostfrei[] schrieb:</p>
<blockquote>
<p>Kommentier mal alles vor der letzten If-Abfrage aus. Dann sollte es eigentlich funktionieren. Will heißen, das Problem liegt vorher. Du schließt die Datenbank z.B. nicht mit Close...</p>
</blockquote>
<p>Dann funktioniert es auch nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /> Hab alles bis zum if auskommentiert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312944</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312944</guid><dc:creator><![CDATA[AlexDozer]]></dc:creator><pubDate>Sun, 24 Jun 2007 18:32:26 GMT</pubDate></item><item><title><![CDATA[Reply to Form2-&amp;gt;Close(); funktioniert nicht on Sun, 24 Jun 2007 18:38:56 GMT]]></title><description><![CDATA[<p>Also bei meinem BCB 6 Enterpr wird das Fenster in OnActivate geschlossen.</p>
<pre><code class="language-cpp">void __fastcall TForm1::FormActivate(TObject *Sender)
{
     Application-&gt;MessageBox(&quot;Keine neuen Dateien gefunden!&quot;, &quot;Nothing found&quot;,  MB_RETRYCANCEL);
     Form1-&gt;Close();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1312949</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312949</guid><dc:creator><![CDATA[Rostfrei**]]></dc:creator><pubDate>Sun, 24 Jun 2007 18:38:56 GMT</pubDate></item><item><title><![CDATA[Reply to Form2-&amp;gt;Close(); funktioniert nicht on Sun, 24 Jun 2007 18:50:24 GMT]]></title><description><![CDATA[<p>Ich hab jetzt alles was zu Form2 gehört auskommentiert bis auf:</p>
<pre><code class="language-cpp">Application-&gt;MessageBox(&quot;Keine neuen Dateien gefunden!&quot;, &quot;Nothing found&quot;,  MB_RETRYCANCEL);
Form2-&gt;Close();
</code></pre>
<p>Aber es funktioniert einfach nicht. Benutze BCB 6 Professional.</p>
<p>Werd mal morgen meinen Lehrer fragen. Vielleicht weis der was <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312960</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312960</guid><dc:creator><![CDATA[AlexDozer]]></dc:creator><pubDate>Sun, 24 Jun 2007 18:50:24 GMT</pubDate></item><item><title><![CDATA[Reply to Form2-&amp;gt;Close(); funktioniert nicht on Sun, 24 Jun 2007 18:55:46 GMT]]></title><description><![CDATA[<p>Vielleicht könnten das mal Andere mit anderen BCB-Versionen testen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312966</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312966</guid><dc:creator><![CDATA[Rostfrei**]]></dc:creator><pubDate>Sun, 24 Jun 2007 18:55:46 GMT</pubDate></item><item><title><![CDATA[Reply to Form2-&amp;gt;Close(); funktioniert nicht on Sun, 24 Jun 2007 23:03:28 GMT]]></title><description><![CDATA[<p>Rostfrei[] schrieb:</p>
<blockquote>
<p>Also bei meinem BCB 6 Enterpr wird das Fenster in OnActivate geschlossen.</p>
</blockquote>
<p>Du benutzt Form1 ! da funktioniert es bei mir auch. Versuchmal in Form2.<br />
bei mir funktioniert es nicht in 'TForm2::FormActivate' bcb6 enterprise.<br />
wohlgemerkt Form2 ! In Form1 schon.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1313007</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1313007</guid><dc:creator><![CDATA[OldMan00]]></dc:creator><pubDate>Sun, 24 Jun 2007 23:03:28 GMT</pubDate></item><item><title><![CDATA[Reply to Form2-&amp;gt;Close(); funktioniert nicht on Mon, 25 Jun 2007 08:02:32 GMT]]></title><description><![CDATA[<p>Mach nach dem Close() einfach mal ein return;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1313154</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1313154</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Mon, 25 Jun 2007 08:02:32 GMT</pubDate></item><item><title><![CDATA[Reply to Form2-&amp;gt;Close(); funktioniert nicht on Mon, 25 Jun 2007 13:17:29 GMT]]></title><description><![CDATA[<p>Funktioniert leider auch nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1313342</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1313342</guid><dc:creator><![CDATA[AlexDozer]]></dc:creator><pubDate>Mon, 25 Jun 2007 13:17:29 GMT</pubDate></item><item><title><![CDATA[Reply to Form2-&amp;gt;Close(); funktioniert nicht on Mon, 25 Jun 2007 13:41:38 GMT]]></title><description><![CDATA[<p>Versuche es damit hier:</p>
<pre><code class="language-cpp">PostMessage(Form2-&gt;Handle,WM_CLOSE,0,0);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1313360</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1313360</guid><dc:creator><![CDATA[_gast_]]></dc:creator><pubDate>Mon, 25 Jun 2007 13:41:38 GMT</pubDate></item><item><title><![CDATA[Reply to Form2-&amp;gt;Close(); funktioniert nicht on Mon, 25 Jun 2007 14:16:16 GMT]]></title><description><![CDATA[<p>das funktioniert bei mir. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1313396</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1313396</guid><dc:creator><![CDATA[OldMan00]]></dc:creator><pubDate>Mon, 25 Jun 2007 14:16:16 GMT</pubDate></item><item><title><![CDATA[Reply to Form2-&amp;gt;Close(); funktioniert nicht on Tue, 26 Jun 2007 13:23:24 GMT]]></title><description><![CDATA[<p>Bei mir auch! Vielen Dank!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1314007</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1314007</guid><dc:creator><![CDATA[AlexDozer]]></dc:creator><pubDate>Tue, 26 Jun 2007 13:23:24 GMT</pubDate></item></channel></rss>