Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Pointer übergabe an Dialog

Empfohlene Antworten

Veröffentlicht

Hallo zusammen

In meinem MainDialog (MFC) rufe ich einen 2ten Dialog auf.

Dieser 2te Dialog braucht jedoch einen Pointer zum ersten Dialog für denn Daten austausch


void CMainDlg::CreateDlg2() {

    m_Dlg2.Create(IDD_Dialog2, NULL);

    m_Dlg2.ShowWindow(true);

    m_Dlg2.SetMainDlg(this);

}


void CDlg2::SetMainDlg(CMainDlg *pDlg) {

    m_MainDlg = pDlg;

    LoadData();

}


void CDlg2::LoadData() {

    m_ObList.AddTail(m_MainDlg->GetObList()); //<- hier treten die Fehler auf

}


CObList* CMainDlg::GetObList() {

    return &m_ObList;

}


/*

Deklarationen der Membervariabeln

*/

// CMainDlg.h

private:

    CDlg2 m_Dlg2

    CObList m_ObList;


// CDlg2.h

private:

    CMainDlg *m_MainDlg

    CObList m_ObList

Der Compiler gibt nun Folgende fehler aus: C2027: use of undefined type 'CMainDlg' see declaration of 'CMainDlg' C2227: left of '->GetObList' must point to class/struct/union Das bedeutet ja eig das CMainDlg bei CDlg2 nicht richtig deklariert ist Ich habe es jedoch so Deklariert:

// CDlg2.h

class CMainDlg; // <-

class CDlg2 : CDialog

{

// ....

Kann mir jemand hier bitte weiterhelfen?

Freundliche grüsse

Neo

class CMainDlg;

Das ist eine sogenannte Forward Declaration. Die reicht aus, um einen Zeiger zu definieren, aber mehr auch nicht. Wenn du über den Zeiger auf Member zugreifen willst, brauchst du die vollständige Klassendefinition von CMainDlg.

Du brauchst also in CDlg2.cpp eine Includedirektive für CMainDlg.h.

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.