You are not logged in.

  • Login

Dear visitor, welcome to Coder Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Wednesday, November 29th 2006, 7:17pm

Auf Dialog aus Klasse zugreifen

Hallo

Ich habe eine normale MFC dialogbasierte Anwendung und eine zusätzliche Klasse die ich geschrieben habe. Auf dem Hauptfenster befindet sich ein static text control. Ich möchte jetzt aus meiner Klasse heraus dieses static text control mit text füllen... Nur wie? Komme ich da über das globale Applikationsobjekt theApp ran? Hat da jemand vielleicht etwas Code?

Danke

2

Wednesday, November 29th 2006, 8:35pm

Hallo,
als erstes gibst du deinem Static Textfeld erstmal ne andere ID als IDC_STATIC.
Dann kannst du im einfachsten Fall mit :

C Quellcode

1
AfxGetMainWnd()->GetDlgItem(IDC_DEIN_TEXT_FELD)->SetWindowText(L"Tach Post");
den Text des Static Feldes verändern.
GetDlgItem ist aus rein objektorientierter Sicht zwar nicht sonderlich schön tut für diese einfache Aufgabe aber durchaus seinen Zweck.

Gruß void

Similar threads

Social bookmarks