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.

MFC: MyApp ---> MyDoc

Empfohlene Antworten

Veröffentlicht

Hallo ihr ;)

Weil mir immer die besten Antworten einfallen, nachdem ich hier schrieb, und morgen das gelöst haben will schreibe ich hier. Sollte ich nicht darauf kommen, gibt es ja noch die wahrscheinlichere Möglichkeit, daß ihr mir helft *freu* ...

Problem:

Wie kann ich von meiner App in MFC das aktuelle Document in einer SDI ansprechen?

GetDocument gibt es nur in View

GetNextDocTemplate in Verbindung zu GetFirstDocTemplatePosition brachte mir nichts. :(

Bin ich auf dem richtigen Wege, oder geht das ganz anders? ...

Bin ich der Einzige, der in MFC von der App zum Doc greifen will?

So geht's nicht ...


POSITION pos = GetFirstDocTemplatePosition();

((MyDoc*)GetNextDocTemplate(pos))->UpdateAlles();

Was ich suche soll NimmActivesDocument ersetzen ... Bsp:

class MyApp : public CWinApp          // oder so ähnlich

...

void MyApp::OnKomischerKnopf()

{

  NimmActivesDocument()->UpdateAlles();

}


...


class MyDoc : public CDocument

...

void MyDoc::UpdateAlles()

{

  // mach was ...

}

Der Ansatz mit GetNextDocTemplate und GetFirstDocTemplatePosition war schon nicht schlecht. Über die CDocTemplate-Zeiger, die Du damit erhältst, kannst Du CDocTemplate::GetFirstDocPosition und CDocTemplate::GetNextDoc aufrufen. Damit kommst Du an die Dokumente.

:rolleyes:

Klotzkopp ... du bist mein Held des Tages.

Das geht ja tatsächlich ... :cool: ... nicht, daß ich gezweifelt hätte ... :D

So sieht das nun aufgeschlüsselt aus:


    POSITION posDocTemp = GetFirstDocTemplatePosition();

    CDocTemplate* pDocTemp = GetNextDocTemplate(posDocTemp);

    POSITION posDoc = pDocTemp->GetFirstDocPosition();

    CMyProgDoc* pActiveDoc = (CMyProgDoc*)pDocTemp->GetNextDoc(posDoc);

    pActiveDoc->StarteMeineUserDefinierteFunktion();

Muß ich halt nur mal seh'n, was ich davon zusammen fasse, und was nicht.

:beagolisc DANKE

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.