<?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[SDI -&gt; Mainframe ändern]]></title><description><![CDATA[<p>Hi,</p>
<p>ich möchte in einer SDI Anwendung die Form im Mainframe ändern. Dazu habe ich gerade die folgende Funktion von Mike gefunden:</p>
<pre><code class="language-cpp">void CMainFrame::SwitchToView(int nView)
{
    CView* pOldActiveView = GetActiveView();
    CView* pNewActiveView = (CView*) GetDlgItem(nView);
    if (pNewActiveView == NULL) {
        switch (nView) {
        case 1:
            pNewActiveView = (CFormView*) new CFirstView;
            break;
        case 2:
            pNewActiveView = (CFormView*) new CSecView;
            break;
        }
        CCreateContext context;
        context.m_pCurrentDoc = pOldActiveView-&gt;GetDocument();
        pNewActiveView-&gt;Create(NULL, NULL, WS_BORDER,
            CFrameWnd::rectDefault, this, nView, &amp;context);
        pNewActiveView-&gt;OnInitialUpdate();
    }
    SetActiveView(pNewActiveView);
    pNewActiveView-&gt;ShowWindow(SW_SHOW);
    pOldActiveView-&gt;ShowWindow(SW_HIDE);
    pOldActiveView-&gt;SetDlgCtrlID(
        pOldActiveView-&gt;GetRuntimeClass() ==
        RUNTIME_CLASS(CFirstView) ? 1 : 2);
    pNewActiveView-&gt;SetDlgCtrlID(AFX_IDW_PANE_FIRST);
    RecalcLayout();
}
</code></pre>
<p>Leider bin ich noch richter Noob in MFC und würde mich über eine ausführliche Beschreibung freuen, wie ich das ganze einbinden muss. Vielleicht auch per ICQ (87235873). Danke im Voraus</p>
<p>[ Dieser Beitrag wurde am 14.06.2003 um 08:23 Uhr von <strong>Unix-Tom</strong> editiert. ]</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/6189/sdi-mainframe-ändern</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Apr 2026 23:24:30 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/6189.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 13 Jun 2003 16:22:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to SDI -&gt; Mainframe ändern on Fri, 13 Jun 2003 16:22:00 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich möchte in einer SDI Anwendung die Form im Mainframe ändern. Dazu habe ich gerade die folgende Funktion von Mike gefunden:</p>
<pre><code class="language-cpp">void CMainFrame::SwitchToView(int nView)
{
    CView* pOldActiveView = GetActiveView();
    CView* pNewActiveView = (CView*) GetDlgItem(nView);
    if (pNewActiveView == NULL) {
        switch (nView) {
        case 1:
            pNewActiveView = (CFormView*) new CFirstView;
            break;
        case 2:
            pNewActiveView = (CFormView*) new CSecView;
            break;
        }
        CCreateContext context;
        context.m_pCurrentDoc = pOldActiveView-&gt;GetDocument();
        pNewActiveView-&gt;Create(NULL, NULL, WS_BORDER,
            CFrameWnd::rectDefault, this, nView, &amp;context);
        pNewActiveView-&gt;OnInitialUpdate();
    }
    SetActiveView(pNewActiveView);
    pNewActiveView-&gt;ShowWindow(SW_SHOW);
    pOldActiveView-&gt;ShowWindow(SW_HIDE);
    pOldActiveView-&gt;SetDlgCtrlID(
        pOldActiveView-&gt;GetRuntimeClass() ==
        RUNTIME_CLASS(CFirstView) ? 1 : 2);
    pNewActiveView-&gt;SetDlgCtrlID(AFX_IDW_PANE_FIRST);
    RecalcLayout();
}
</code></pre>
<p>Leider bin ich noch richter Noob in MFC und würde mich über eine ausführliche Beschreibung freuen, wie ich das ganze einbinden muss. Vielleicht auch per ICQ (87235873). Danke im Voraus</p>
<p>[ Dieser Beitrag wurde am 14.06.2003 um 08:23 Uhr von <strong>Unix-Tom</strong> editiert. ]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30012</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30012</guid><dc:creator><![CDATA[Doomrunner]]></dc:creator><pubDate>Fri, 13 Jun 2003 16:22:00 GMT</pubDate></item><item><title><![CDATA[Reply to SDI -&gt; Mainframe ändern on Sat, 14 Jun 2003 07:39:00 GMT]]></title><description><![CDATA[<p>Einfach ne Memberfunktion in CMainFrame und mit<br />
CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();<br />
pMain-&gt;SwitchToView(1);<br />
Habs bis jetzt immer nur mit CView verwendet (CFormView is net mei Ding) - also lass dich überracshen obs funzt <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>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30013</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30013</guid><dc:creator><![CDATA[mike]]></dc:creator><pubDate>Sat, 14 Jun 2003 07:39:00 GMT</pubDate></item><item><title><![CDATA[Reply to SDI -&gt; Mainframe ändern on Sat, 14 Jun 2003 09:50:00 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich habe jetzt die Funktion in die MainFrame.cpp eingebunden. In die MainFrame.h habe ich über einen Include die beiden Dialog-Headerfiles mit eingebunden. Wenn ich das Programm jetzt allerdings ausführen will, so erhalte ich folgende 2 Fehler:</p>
<p>C:\Programme\Microsoft Visual Studio\MyProjects\SDI4\MainFrm.cpp(133) : error C2653: 'CFirstView' : is not a class or namespace name<br />
C:\Programme\Microsoft Visual Studio\MyProjects\SDI4\MainFrm.cpp(133) : error C2065: 'classCFirstView' : undeclared identifier</p>
<p>Was habe ich noch falsch gemacht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30014</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30014</guid><dc:creator><![CDATA[Doomrunner]]></dc:creator><pubDate>Sat, 14 Jun 2003 09:50:00 GMT</pubDate></item><item><title><![CDATA[Reply to SDI -&gt; Mainframe ändern on Sat, 14 Jun 2003 09:52:00 GMT]]></title><description><![CDATA[<p>Hast du FirstView.h eigebunden?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30015</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30015</guid><dc:creator><![CDATA[Walli]]></dc:creator><pubDate>Sat, 14 Jun 2003 09:52:00 GMT</pubDate></item><item><title><![CDATA[Reply to SDI -&gt; Mainframe ändern on Sat, 14 Jun 2003 10:37:00 GMT]]></title><description><![CDATA[<p>Ok, das war noch ein Fehler. Hatte CFirstView noch nicht durch den namen meines ersten Fensters ersetzt. Das habe ich jetzt aber gemacht. Und ich bekomme wieder folgenden Fehler:</p>
<p>C:\Programme\Microsoft Visual Studio\MyProjects\SDI4\MainFrm.cpp(133) : error C2039: 'classCDialog1' : is not a member of 'CDialog1'<br />
c:\programme\microsoft visual studio\myprojects\sdi4\dialog1.h(13) : see declaration of 'CDialog1'<br />
C:\Programme\Microsoft Visual Studio\MyProjects\SDI4\MainFrm.cpp(133) : error C2065: 'classCDialog1' : undeclared identifier<br />
SDI4.cpp</p>
<p>Wie gesagt. Die Header-Dateien beider Dialoge (CDialog1 und CDialog2) sind eingebunden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30016</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30016</guid><dc:creator><![CDATA[Doomrunner]]></dc:creator><pubDate>Sat, 14 Jun 2003 10:37:00 GMT</pubDate></item><item><title><![CDATA[Reply to SDI -&gt; Mainframe ändern on Sat, 14 Jun 2003 11:27:00 GMT]]></title><description><![CDATA[<p>Von welcher Klasse ist CDialog1 abgeleitet?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30017</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30017</guid><dc:creator><![CDATA[*mike*]]></dc:creator><pubDate>Sat, 14 Jun 2003 11:27:00 GMT</pubDate></item><item><title><![CDATA[Reply to SDI -&gt; Mainframe ändern on Sat, 14 Jun 2003 12:39:00 GMT]]></title><description><![CDATA[<p>Basisklasse von CDialog1 und CDialog2 ist CDialog</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30018</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30018</guid><dc:creator><![CDATA[Doomrunner]]></dc:creator><pubDate>Sat, 14 Jun 2003 12:39:00 GMT</pubDate></item><item><title><![CDATA[Reply to SDI -&gt; Mainframe ändern on Sat, 14 Jun 2003 14:47:00 GMT]]></title><description><![CDATA[<p>Du switch't dort Views und keine Dialoge.</p>
<p>Basisklasse der erstellten Dialoge sollte CView(CFormView) sein, um sie dann dort einzubinden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30019</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30019</guid><dc:creator><![CDATA[MuehBln]]></dc:creator><pubDate>Sat, 14 Jun 2003 14:47:00 GMT</pubDate></item><item><title><![CDATA[Reply to SDI -&gt; Mainframe ändern on Sat, 14 Jun 2003 15:02:00 GMT]]></title><description><![CDATA[<p>Ok,</p>
<p>habe jetzt nochmal ne neue Applikation aufgebaut. Die beiden Fenster sind jetzt Test1 und Test2 und sind von CFormView abgeleitet. Es tauchen jetzt nur noch die beiden Fehlermeldungen auf:</p>
<p>E:\Tools\Visual C Lernprogramm\Beispiel\SDI5\MainFrm.cpp(117) : error C2248: 'Test1::Test1' : cannot access protected member declared in class 'Test1'<br />
e:\tools\visual c lernprogramm\beispiel\sdi5\test1.h(20) : see declaration of 'Test1::Test1'<br />
E:\Tools\Visual C Lernprogramm\Beispiel\SDI5\MainFrm.cpp(120) : error C2248: 'Test2::Test2' : cannot access protected member declared in class 'Test2'<br />
e:\tools\visual c lernprogramm\beispiel\sdi5\test2.h(20) : see declaration of 'Test2::Test2'</p>
<p>was ist nun zu tun? Schonmal dicken Dank im Voraus. Super Community hier. Werde mich auch einbringen und helfen, wenn ich soweit bin...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30020</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30020</guid><dc:creator><![CDATA[Doomrunner]]></dc:creator><pubDate>Sat, 14 Jun 2003 15:02:00 GMT</pubDate></item><item><title><![CDATA[Reply to SDI -&gt; Mainframe ändern on Sat, 14 Jun 2003 15:11:00 GMT]]></title><description><![CDATA[<p>Machs public und du wirst keine Probs mehr haben <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/30021</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30021</guid><dc:creator><![CDATA[*mike*]]></dc:creator><pubDate>Sat, 14 Jun 2003 15:11:00 GMT</pubDate></item><item><title><![CDATA[Reply to SDI -&gt; Mainframe ändern on Sat, 14 Jun 2003 15:34:00 GMT]]></title><description><![CDATA[<p>So, jetzt kommt kein Fehler mehr beim ausführen. Im Menü habe ich jetzt einen Punkt eingefügt und mit dem Code folgenden Code versehen:</p>
<p>CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();<br />
pMain-&gt;SwitchToView(1);</p>
<p>Wenn ich dann im laufenden Programm bin und auf den Menüpunkt klicke, so stürzt das Programm ab. Wodran kann das denn jetzt noch liegen? *heul</p>
<p><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/30022</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30022</guid><dc:creator><![CDATA[Doomrunner]]></dc:creator><pubDate>Sat, 14 Jun 2003 15:34:00 GMT</pubDate></item><item><title><![CDATA[Reply to SDI -&gt; Mainframe ändern on Sat, 14 Jun 2003 16:07:00 GMT]]></title><description><![CDATA[<p>Hoppla *hau Kopf gegen die Mauer* CFormView kennt den Style WS_BORDER ja nicht. Korrekgierte Version:</p>
<pre><code class="language-cpp">CView* pOldActiveView = GetActiveView();
    CView* pNewActiveView = (CView*) GetDlgItem(nView);
    if (pNewActiveView == NULL) {
        switch (nView) {
        case 0:
            pNewActiveView = (CFormView*) new CTest2View;
            break;
        case 1:
            pNewActiveView = (CFormView*) new CForm2;
            break;
        }
        CCreateContext context;
        context.m_pCurrentDoc = pOldActiveView-&gt;GetDocument();
        pNewActiveView-&gt;Create(NULL, NULL, NULL,
            CFrameWnd::rectDefault, this, nView, &amp;context);
        pNewActiveView-&gt;OnInitialUpdate();
    }
    SetActiveView(pNewActiveView);
    pNewActiveView-&gt;ShowWindow(SW_SHOW);
    pOldActiveView-&gt;ShowWindow(SW_HIDE);
    pOldActiveView-&gt;SetDlgCtrlID(
        pOldActiveView-&gt;GetRuntimeClass() == 
        RUNTIME_CLASS(CTest2View) ? 0 : 1);
    pNewActiveView-&gt;SetDlgCtrlID(AFX_IDW_PANE_FIRST);
    RecalcLayout();
</code></pre>
<p>mfg mike</p>
<p>[ Dieser Beitrag wurde am 14.06.2003 um 18:07 Uhr von <strong>*mike*</strong> editiert. ]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30023</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30023</guid><dc:creator><![CDATA[*mike*]]></dc:creator><pubDate>Sat, 14 Jun 2003 16:07:00 GMT</pubDate></item><item><title><![CDATA[Reply to SDI -&gt; Mainframe ändern on Sat, 14 Jun 2003 16:11:00 GMT]]></title><description><![CDATA[<p>ok. Da laut MSDN der 3 Param ein DWORD ist <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<pre><code class="language-cpp">pNewActiveView-&gt;Create(NULL, NULL, 0L,
   CFrameWnd::rectDefault, this, nView, &amp;context);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/30024</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30024</guid><dc:creator><![CDATA[*mike*]]></dc:creator><pubDate>Sat, 14 Jun 2003 16:11:00 GMT</pubDate></item><item><title><![CDATA[Reply to SDI -&gt; Mainframe ändern on Sun, 15 Jun 2003 11:11:00 GMT]]></title><description><![CDATA[<p>Hallo Mike, jetzt funktioniert das hin- und herschalten fast. Das Programm stürzt nicht ab, und es wird geschaltet. Allerdings vertauschen sich die Fensteraufrufe ganz seltsam.</p>
<p>Wenn ich z.B. folgendes mache:</p>
<p>[Aufruf -&gt; Ergebnis]</p>
<p>Fenster 2 -&gt; Fenster 2<br />
Fenster 1 -&gt; Fenster 1<br />
Fenster 2 -&gt; leer<br />
Fenster 2 -&gt; Fenster 1</p>
<p>Kannst du dir das erklären?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30025</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30025</guid><dc:creator><![CDATA[Doomrunner]]></dc:creator><pubDate>Sun, 15 Jun 2003 11:11:00 GMT</pubDate></item><item><title><![CDATA[Reply to SDI -&gt; Mainframe ändern on Sun, 15 Jun 2003 11:44:00 GMT]]></title><description><![CDATA[<p>Moin<br />
Du kannst im z.B. im case falsche Zahlen haben<br />
Ich hatte mal das gleiche Problem. Das kann passieren, wenn du die Klickeriegnisse falsch abfängst. Falls du im Menü switch ist der Fehler zu 99% in der Switchfunktion. Die Reihenfolge in der Funktion ist wichtig!!!!</p>
<p>Sonst Debugger nutzen!!<br />
mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30026</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30026</guid><dc:creator><![CDATA[*mike*]]></dc:creator><pubDate>Sun, 15 Jun 2003 11:44:00 GMT</pubDate></item><item><title><![CDATA[Reply to SDI -&gt; Mainframe ändern on Sun, 15 Jun 2003 21:32:00 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich habe jetzt mal folgendes gemacht:</p>
<p>1. Speicher ich das zuletzt eingeblendete Fenster um das dann in dem Block</p>
<pre><code>switch (nViewOld) {
        case 0:
            pOldActiveView-&gt;SetDlgCtrlID(
                pOldActiveView-&gt;GetRuntimeClass() == 
                RUNTIME_CLASS(Test1) ? 0 : 1);
        break;
        case 1:
            pOldActiveView-&gt;SetDlgCtrlID(
                pOldActiveView-&gt;GetRuntimeClass() == 
                RUNTIME_CLASS(Test2) ? 0 : 1);
        break;
        case 2:
            pOldActiveView-&gt;SetDlgCtrlID(
                pOldActiveView-&gt;GetRuntimeClass() == 
                RUNTIME_CLASS(Test3) ? 0 : 1);
        break;
    }
</code></pre>
<p>wieder auszuschalten. Danach habe ich gemerkt, dass das richtige Fenster angezeigt wird, wenn ich mehrmals auf den button klicke. Deshalb lasse ich die ganze Funktion in einer for-schleife Laufen, die dann 20mal die Fenster aktiviert. Ist zwar nicht die sauberste Art und Weise aber es funktioniert. Was haltet Ihr davon?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30027</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30027</guid><dc:creator><![CDATA[Doomrunner]]></dc:creator><pubDate>Sun, 15 Jun 2003 21:32:00 GMT</pubDate></item><item><title><![CDATA[Reply to SDI -&gt; Mainframe ändern on Mon, 16 Jun 2003 05:45:00 GMT]]></title><description><![CDATA[<p>rofl<br />
Kommt dir ne for Schleife die 20mal die Funktion aufruft sauber bzw. gut vor?<br />
Du musst nur mal den Debugger nutzen und du wirst den Fehler finden. Wenn du willst schick ich dir am WE mal ein Sample.</p>
<p>mfg mike</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30028</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30028</guid><dc:creator><![CDATA[*mike*]]></dc:creator><pubDate>Mon, 16 Jun 2003 05:45:00 GMT</pubDate></item><item><title><![CDATA[Reply to SDI -&gt; Mainframe ändern on Mon, 16 Jun 2003 10:47:00 GMT]]></title><description><![CDATA[<p>Habe ja gesagt, dass ich echter noop bin. Ich programmiere zwar schon seit über 4 Jahren mit Perl (und habe damit schon verdammt komplexe Intranet- und Internetapplikationen erstellt), doch das nützt mir leider nur wenig bei C++. Habe erst vor ner Woche damit angefangen und habe mir in der Zeit aber schon enormes Wissen reingezogen.</p>
<p>Ich würde mich sehr freuen, wenn du mir mal das ein oder andere Beispielprogramm rüber schicken würdest, so dass ich mir das mal anschauen kann. Allerdings müsste die MFC Library eingebunden sein. Sonst laufen die Proggis bei mir nicht.</p>
<p>Danke schonmal im Voraus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30029</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30029</guid><dc:creator><![CDATA[Doomrunner]]></dc:creator><pubDate>Mon, 16 Jun 2003 10:47:00 GMT</pubDate></item></channel></rss>