Megosztás a következőn keresztül:


CTaskDialog osztály

Egy előugró párbeszédpanel, amely üzenetmezőként működik, de további információkat jeleníthet meg a felhasználó számára. A CTaskDialog a felhasználótól származó információk gyűjtésére szolgáló funkciókat is tartalmaz.

Szintaxis

class CTaskDialog : public CObject

Tagok

Konstruktorok

Név Leírás
CTaskDialog::CTaskDialog Egy CTaskDialog objektumot hoz létre.

Módszerek

Név Leírás
CTaskDialog::AddCommandControl Parancsgomb vezérlőelem hozzáadása a CTaskDialog.
CTaskDialog::AddRadioButton Választógomb hozzáadása a CTaskDialog.
CTaskDialog::ClickCommandControl A parancsgomb vezérlőelemre vagy a gyakori gombra programozott módon kattint.
CTaskDialog::ClickRadioButton A választógombra programozott módon kattint.
CTaskDialog::D oModal Megjeleníti a CTaskDialog.
CTaskDialog::GetCommonButtonCount Lekéri az elérhető gyakori gombok számát.
CTaskDialog::GetCommonButtonFlag Szabványos Windows-gombot konvertál a CTaskDialog osztályhoz társított gyakori gombtípusra.
CTaskDialog::GetCommonButtonId A CTaskDialog osztályhoz társított egyik gyakori gombtípust szabványos Windows-gombmá alakítja.
CTaskDialog::GetOptions A CTaskDialogbeállításjelzőit adja vissza.
CTaskDialog::GetSelectedCommandControlID A kijelölt parancsgomb vezérlőelemét adja vissza.
CTaskDialog::GetSelectedRadioButtonID A kiválasztott választógombot adja vissza.
CTaskDialog::GetVerificationCheckboxState Lekéri az ellenőrzési jelölőnégyzet állapotát.
CTaskDialog::IsCommandControlEnabled Meghatározza, hogy engedélyezve van-e a parancsgomb-vezérlő vagy a gyakori gomb.
CTaskDialog::IsRadioButtonEnabled Meghatározza, hogy engedélyezve van-e a választógomb.
CTaskDialog::IsSupported Meghatározza, hogy az alkalmazást futtató számítógép támogatja-e a CTaskDialog.
CTaskDialog::LoadCommandControls A parancsgomb vezérlőit a sztringtáblából származó adatokkal adja hozzá.
CTaskDialog::LoadRadioButtons A sztringtáblából származó adatokkal adja hozzá a választógombokat.
CTaskDialog::NavigateTo Áthelyezi a fókuszt egy másik CTaskDialog.
CTaskDialog::OnCommandControlClick A keretrendszer meghívja ezt a metódust, amikor a felhasználó egy parancsgomb vezérlőelemére kattint.
CTaskDialog::OnCreate A keretrendszer a CTaskDialoglétrehozása után meghívja ezt a metódust.
CTaskDialog::OnDestroy A keretrendszer ezt a metódust közvetlenül azelőtt hívja meg, hogy megsemmisítené a CTaskDialog.
CTaskDialog::OnExpandButtonClick A keretrendszer meghívja ezt a metódust, amikor a felhasználó a bővítő gombra kattint.
CTaskDialog::OnHelp A keretrendszer meghívja ezt a metódust, amikor a felhasználó segítséget kér.
CTaskDialog::OnHyperlinkClick A keretrendszer meghívja ezt a metódust, amikor a felhasználó egy hivatkozásra kattint.
CTaskDialog::OnInit A keretrendszer ezt a metódust a CTaskDialog inicializálásakor hívja meg.
CTaskDialog::OnNavigatePage A keretrendszer ezt a metódust hívja meg, amikor a felhasználó a CTaskDialogvezérlőire helyezi a fókuszt.
CTaskDialog::OnRadioButtonClick A keretrendszer meghívja ezt a metódust, amikor a felhasználó kiválaszt egy választógomb-vezérlőt.
CTaskDialog::OnTimer A keretrendszer ezt a metódust hívja meg az időzítő lejáratakor.
CTaskDialog::OnVerificationCheckboxClick A keretrendszer meghívja ezt a metódust, amikor a felhasználó az ellenőrző jelölőnégyzetre kattint.
CTaskDialog::RemoveAllCommandControls Eltávolítja az összes parancsvezérlőt a CTaskDialog.
CTaskDialog::RemoveAllRadioButtons Eltávolítja az összes választógombot a CTaskDialog.
CTaskDialog::SetCommandControlOptions A parancsgomb vezérlőjének frissítése a CTaskDialog.
CTaskDialog::SetCommonButtonOptions Frissíti a közös gombok egy részhalmazát, hogy engedélyezve legyen, és UAC-jogosultságszint-emelést igényeljen.
CTaskDialog::SetCommonButtons Általános gombokat ad hozzá a CTaskDialog.
CTaskDialog::SetContent Frissíti a CTaskDialogtartalmát.
CTaskDialog::SetDefaultCommandControl Megadja az alapértelmezett parancsgomb-vezérlőt.
CTaskDialog::SetDefaultRadioButton Az alapértelmezett választógombot adja meg.
CTaskDialog::SetDialogWidth A CTaskDialogszélességének beállítása.
CTaskDialog::SetExpansionArea Frissíti a CTaskDialogbővítőterületét.
CTaskDialog::SetFooterIcon Frissíti a CTaskDialogélőláb ikont.
CTaskDialog::SetFooterText Frissíti a CTaskDialogláblécének szövegét.
CTaskDialog::SetMainIcon Frissíti a CTaskDialogfő ikonját.
CTaskDialog::SetMainInstruction Frissíti a CTaskDialogfő utasítását.
CTaskDialog::SetOptions Konfigurálja a CTaskDialogbeállításait.
CTaskDialog::SetProgressBarMarquee Konfigurál egy sávot a CTaskDialog, és hozzáadja a párbeszédpanelhez.
CTaskDialog::SetProgressBarPosition Beállítja a folyamatjelző sáv pozícióját.
CTaskDialog::SetProgressBarRange A folyamatjelző sáv tartományának beállítása.
CTaskDialog::SetProgressBarState Beállítja a folyamatjelző sáv állapotát, és megjeleníti az CTaskDialog.
CTaskDialog::SetRadioButtonOptions Engedélyezi vagy letiltja a választógombot.
CTaskDialog::SetVerificationCheckbox Az ellenőrző jelölőnégyzet bejelölt állapotát állítja be.
CTaskDialog::SetVerificationCheckboxText Az ellenőrző jelölőnégyzet jobb oldalán lévő szöveget állítja be.
CTaskDialog::SetWindowTitle A CTaskDialogcímét állítja be.
CTaskDialog::ShowDialog Létrehoz és megjelenít egy CTaskDialog.
CTaskDialog::TaskDialogCallback A keretrendszer ezt különböző Windows-üzenetekre válaszul hívja meg.

Adattagok

Név Leírás
m_aButtons A CTaskDialogparancsgomb-vezérlőinek tömbje.
m_aRadioButtons A CTaskDialogválasztógomb-vezérlőinek tömbje.
m_bVerified TRUE jelzi, hogy az ellenőrző jelölőnégyzet be van jelölve; FALSE azt jelzi, hogy nem.
m_footerIcon A CTaskDialogláblécének ikonja.
m_hWnd A CTaskDialogablakának fogópontja.
m_mainIcon A CTaskDialogfő ikonja.
m_nButtonDisabled Maszk, amely azt jelzi, hogy a gyakori gombok közül melyik le van tiltva.
m_nButtonElevation Maszk, amely azt jelzi, hogy a gyakori gombok közül melyik igényel UAC-emelést.
m_nButtonId A kijelölt parancsgomb vezérlőelem azonosítója.
m_nCommonButton Maszk, amely jelzi, hogy mely gyakori gombok jelennek meg a CTaskDialog.
m_nDefaultCommandControl A parancsgomb vezérlőelem azonosítója, amely a CTaskDialog megjelenésekor van kiválasztva.
m_nDefaultRadioButton A CTaskDialog megjelenésekor kiválasztott választógomb-vezérlő azonosítója.
m_nFlags A CTaskDialogbeállításait jelző maszk.
m_nProgressPos A folyamatjelző sáv aktuális pozíciója. Ennek az értéknek m_nProgressRangeMin és m_nProgressRangeMaxközött kell lennie.
m_nProgressRangeMax A folyamatjelző sáv maximális értéke.
m_nProgressRangeMin A folyamatjelző sáv minimális értéke.
m_nProgressState A folyamatjelző sáv állapota. További információ: CTaskDialog::SetProgressBarState.
m_nRadioId A kiválasztott választógomb vezérlőelem azonosítója.
m_nWidth A CTaskDialog szélessége képpontban.
m_strCollapse Az a sztring, amelyet a CTaskDialog a bővítőmező jobb oldalán jelenít meg, amikor a kibontott információ el van rejtve.
m_strContent A CTaskDialogtartalomsztringje.
m_strExpand Az a sztring, amelyet a CTaskDialog a bővítőmező jobb oldalán jelenít meg a kibontott információk megjelenítésekor.
m_strFooter A CTaskDialoglábléce.
m_strInformation A CTaskDialogbővített információi.
m_strMainInstruction A CTaskDialogfő utasítása.
m_strTitle A CTaskDialogcíme.
m_strVerification Az a sztring, amelyet a CTaskDialog az ellenőrző jelölőnégyzet jobb oldalán jelenít meg.

Megjegyzések

A CTaskDialog osztály lecseréli a szabványos Windows-üzenetmezőt, és további funkciókkal, például új vezérlőkkel rendelkezik, amelyekkel információkat gyűjthet a felhasználótól. Ez az osztály a Visual Studio 2010 és újabb verziók MFC-könyvtárában található. A CTaskDialog a Windows Vista-tól kezdve érhető el. A Windows korábbi verziói nem tudják megjeleníteni a CTaskDialog objektumot. A CTaskDialog::IsSupported használatával állapítsa meg futásidőben, hogy az aktuális felhasználó megjelenítheti-e a feladat párbeszédpanelt. A standard Windows üzenetmező továbbra is támogatott.

A CTaskDialog csak akkor érhető el, ha az alkalmazást a Unicode-kódtár használatával hozza létre.

A CTaskDialog két különböző konstruktorból áll. Egy konstruktor segítségével két parancsgombot és legfeljebb hat normál gombvezérlőt adhat meg. A CTaskDialoglétrehozása után további parancsgombokat is hozzáadhat. A második konstruktor nem támogatja a parancsgombokat, de korlátlan számú normál gombvezérlőt adhat hozzá. További információ a konstruktorokról: CTaskDialog::CTaskDialog.

Az alábbi képen egy minta CTaskDialog látható, amely néhány vezérlő helyét szemlélteti.

CTaskDialog példa.
CTaskDialog minta

Követelmények

Minimálisan szükséges operációs rendszer: Windows Vista

fejléc: afxtaskdialog.h

CTaskDialog::AddCommandControl

Új parancsgomb vezérlőelemet ad hozzá a CTaskDialog.

void AddCommandControl(
    int nCommandControlID,
    const CString& strCaption,
    BOOL bEnabled = TRUE,
    BOOL bRequiresElevation = FALSE);

Paraméterek

nCommandControlID
[in] A parancsvezérlő azonosítószáma.

strCaption
[in] Az a sztring, amelyet a CTaskDialog megjelenít a felhasználó számára. Ezzel a sztringgel magyarázhatja el a parancs célját.

bEnabled
[in] Logikai paraméter, amely jelzi, hogy az új gomb engedélyezve van-e vagy le van-e tiltva.

bRequiresElevation
[in] Logikai paraméter, amely azt jelzi, hogy a parancsok emelést igényelnek-e.

Megjegyzések

A CTaskDialog Class korlátlan számú parancsgomb-vezérlőt jeleníthet meg. Ha azonban egy CTaskDialog parancsgomb-vezérlőket jelenít meg, legfeljebb hat gombot jeleníthet meg. Ha egy CTaskDialog nincsenek parancsgomb-vezérlői, korlátlan számú gombot jeleníthet meg.

Amikor a felhasználó kiválaszt egy parancsgomb vezérlőelemet, a CTaskDialog bezárul. Ha az alkalmazás CTaskDialog::D oModalhasználatával jeleníti meg a párbeszédpanelt, DoModal a kijelölt parancsgomb vezérlőelem nCommandControlID adja vissza.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title.
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::AddRadioButton

Választógomb hozzáadása a CTaskDialog.

void CTaskDialog::AddRadioButton(
    int nRadioButtonID,
    const CString& strCaption,
    BOOL bEnabled = TRUE);

Paraméterek

nRadioButtonID
[in] A választógomb azonosítószáma.

strCaption
[in] Az a sztring, amelyet a CTaskDialog a választógomb mellett jelenít meg.

bEnabled
[in] Logikai paraméter, amely jelzi, hogy a választógomb engedélyezve van-e.

Megjegyzések

A CTaskDialog osztály választógombjai lehetővé teszik, hogy információkat gyűjtsön a felhasználótól. A CTaskDialog::GetSelectedRadioButtonID függvénnyel állapítsa meg, hogy melyik választógomb van kiválasztva.

A CTaskDialog nem követeli meg, hogy a nRadioButtonID paraméterek egyediek legyenek az egyes választógombokhoz. Előfordulhat azonban, hogy váratlan viselkedést tapasztal, ha nem használ külön azonosítót az egyes választógombokhoz.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

CTaskDialog::ClickCommandControl

A parancsgomb vezérlőelemre vagy a gyakori gombra programozott módon kattint.

protected:
void ClickCommandControl(int nCommandControlID) const;

Paraméterek

nCommandControlID
[in] A vezérlő parancsazonosítója, a gombra kattintva.

Megjegyzések

Ez a metódus létrehozza a Windows-üzenet TDM_CLICK_BUTTON.

CTaskDialog::ClickRadioButton

A választógombra programozott módon kattint.

protected:
void ClickRadioButton(int nRadioButtonID) const;

Paraméterek

nRadioButtonID
[in] A kattintani kívánt választógomb azonosítója.

Megjegyzések

Ez a metódus létrehozza a windowsos üzenetet TDM_CLICK_RADIO_BUTTON.

CTaskDialog::CTaskDialog

Létrehozza a CTaskDialog osztályegy példányát.

CTaskDialog(
    const CString& strContent,
    const CString& strMainInstruction,
    const CString& strTitle,
    int nCommonButtons = TDCBF_OK_BUTTON | TDCBF_CANCEL_BUTTON,
    int nTaskDialogOptions = TDF_ENABLE_HYPERLINKS | TDF_USE_COMMAND_LINKS,
    const CString& strFooter = _T(""));

CTaskDialog(
    const CString& strContent,
    const CString& strMainInstruction,
    const CString& strTitle,
    int nIDCommandControlsFirst,
    int nIDCommandControlsLast,
    int nCommonButtons,
    int nTaskDialogOptions = TDF_ENABLE_HYPERLINKS | TDF_USE_COMMAND_LINKS,
    const CString& strFooter = _T(""));

Paraméterek

strContent
[in] A CTaskDialogtartalmához használandó sztring.

strMainInStruction
[in] A CTaskDialogfő utasítása.

strTitle
[in] A CTaskDialogcíme.

nCommonButtons
[in] A CTaskDialoghozzáadni kívánt gyakori gombok maszkja.

nTaskDialogOptions
[in] A CTaskDialoghasználható beállítások készlete.

strFooter
[in] Az élőlábként használni kívánt sztring.

nIDCommandControlsFirst
[in] Az első parancs sztringazonosítója.

nIDCommandControlsLast
[in] Az utolsó parancs sztringazonosítója.

Megjegyzések

Kétféleképpen adhat hozzá CTaskDialog az alkalmazáshoz. Az első módszer az, hogy az egyik konstruktor használatával létrehoz egy CTaskDialog, és megjeleníti azt CTaskDialog::D oModalhasználatával. A második módszer a CTaskDialog::ShowDialog statikusfüggvény használata, amely lehetővé teszi, hogy CTaskDialog explicit módon hozzon létre CTaskDialog objektumot.

A második konstruktor parancsgomb-vezérlőket hoz létre az alkalmazás erőforrásfájljából származó adatok használatával. Az erőforrásfájl sztringtáblája több sztringgel és társított karakterláncazonosítóval rendelkezik. Ez a metódus egy parancsgomb-vezérlőt ad hozzá a sztringtáblában lévő összes érvényes bejegyzéshez az nIDCommandControlsFirst és nCommandControlsLastközött, beleértve azokat is. A parancsgomb vezérlőinél a sztringtáblában lévő sztring a vezérlő felirata, a sztringazonosító pedig a vezérlő azonosítója.

Az érvényes beállítások listáját a CTaskDialog::SetOptions című témakörben találja.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::D oModal

Megjeleníti a CTaskDialog, és modálissá teszi.

INT_PTR DoModal (HWND hParent = ::GetActiveWindow());

Paraméterek

hParent
[in] A CTaskDialogszülőablaka.

Visszaadott érték

A felhasználó által megadott kijelölésnek megfelelő egész szám.

Megjegyzések

Megjeleníti a CTaskDialogjelen példányát. Az alkalmazás ezután megvárja, amíg a felhasználó bezárja a párbeszédpanelt.

A CTaskDialog bezárul, amikor a felhasználó kiválaszt egy közös gombot, egy parancshivatkozás-vezérlőt, vagy bezárja a CTaskDialog. A visszatérési érték az az azonosító, amely jelzi, hogy a felhasználó hogyan zárta be a párbeszédpanelt.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::GetCommonButtonCount

Lekéri a gyakori gombok számát.

int GetCommonButtonCount() const;

Visszaadott érték

Az elérhető gyakori gombok száma.

Megjegyzések

A gyakori gombok a CTaskDialog::CTaskDialog alapértelmezett gombjai. A CTaskDialog osztály a párbeszédpanel alján lévő gombokat jeleníti meg.

A gombok felsorolását a CommCtrl.h tartalmazza.

CTaskDialog::GetCommonButtonFlag

Szabványos Windows-gombot konvertál a CTaskDialog Osztálytársított gyakori gombtípusra.

int GetCommonButtonFlag(int nButtonId) const;

Paraméterek

nButtonId
[in] A Windows normál gombértéke.

Visszaadott érték

A megfelelő CTaskDialog közös gomb értéke. Ha nincs megfelelő közös gomb, ez a metódus 0 értéket ad vissza.

CTaskDialog::GetCommonButtonId

A CTaskDialog osztályhoz tartozó egyik gyakori gombtípust normál Windows-gombmá alakítja át.

int GetCommonButtonId(int nFlag);

Paraméterek

nFlag
[in] A CTaskDialog osztályhoz társított gyakori gombtípus.

Visszaadott érték

A megfelelő szabványos Windows-gomb értéke. Ha nincs megfelelő Windows-gomb, a metódus 0 értéket ad vissza.

CTaskDialog::GetOptions

A CTaskDialogbeállításjelzőit adja vissza.

int GetOptions() const;

Visszaadott érték

A CTaskDialogjelzői.

Megjegyzések

A CTaskDialog osztályelérhető beállításairól a CTaskDialog::SetOptions címűtémakörben talál további információt.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::GetSelectedCommandControlID

A kijelölt parancsgomb vezérlőelemét adja vissza.

int GetSelectedCommandControlID() const;

Visszaadott érték

Az aktuálisan kijelölt parancsgomb vezérlőelem azonosítója.

Megjegyzések

Nem kell ezzel a módszerrel lekérnie a felhasználó által kiválasztott parancsgomb azonosítóját. Ezt az azonosítót CTaskDialog::D oModal vagy CTaskDialog::ShowDialogadja vissza.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title.
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::GetSelectedRadioButtonID

A kiválasztott választógombot adja vissza.

int GetSelectedRadioButtonID() const;

Visszaadott érték

A kiválasztott választógomb azonosítója.

Megjegyzések

Ezt a módszert akkor használhatja, ha a felhasználó bezárja a párbeszédpanelt a kiválasztott választógomb lekéréséhez.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

CTaskDialog::GetVerificationCheckboxState

Lekéri az ellenőrzési jelölőnégyzet állapotát.

BOOL GetVerificationCheckboxState() const;

Visszaadott érték

IGAZ, ha a jelölőnégyzet be van jelölve, hamis, ha nem.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Add the verification checkbox and set the default state.
taskDialog.SetVerificationCheckboxText(L"Remember your selection.");
taskDialog.SetVerificationCheckbox(false);

taskDialog.DoModal();

if (taskDialog.GetVerificationCheckboxState())
{
   // TODO: Write settings of the task dialog to the registry
}

CTaskDialog::IsCommandControlEnabled

Meghatározza, hogy engedélyezve van-e egy parancsgomb vezérlőeleme vagy gombja.

BOOL IsCommandControlEnabled(int nCommandControlID) const;

Paraméterek

nCommandControlID
[in] A tesztelni kívánt parancsgomb vezérlőjének vagy gombjának azonosítója.

Visszaadott érték

IGAZ, ha a vezérlő engedélyezve van, HAMIS, ha nem.

Megjegyzések

Ezzel a módszerrel meghatározhatja a parancsgomb-vezérlők és a CTaskDialog osztály közös gombjainak* rendelkezésre állását.

Ha nCommandControlID nem érvényes azonosító egy közös CTaskDialog gombhoz vagy parancsgomb vezérlőelemhez, ez a metódus kivételt eredményez.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title.
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::IsRadioButtonEnabled

Meghatározza, hogy engedélyezve van-e a választógomb.

BOOL IsRadioButtonEnabled(int nRadioButtonID) const;

Paraméterek

nRadioButtonID
[in] A tesztelni kívánt választógomb azonosítója.

Visszaadott érték

IGAZ, ha a választógomb engedélyezve van, HAMIS, ha nem.

Megjegyzések

Ha nRadioButtonID nem érvényes azonosító egy választógombhoz, ez a metódus kivételt eredményez.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

CTaskDialog::IsSupported

Meghatározza, hogy az alkalmazást futtató számítógép támogatja-e a CTaskDialog.

static BOOL IsSupported();

Visszaadott érték

IGAZ, ha a számítógép támogatja a CTaskDialog; HAMIS egyéb esetben.

Megjegyzések

Ezzel a függvénnyel állapíthatja meg futásidőben, hogy az alkalmazást futtató számítógép támogatja-e a CTaskDialog osztályt. Ha a számítógép nem támogatja a CTaskDialog, adjon meg egy másik módszert az információk felhasználónak való továbbítására. Az alkalmazás összeomlik, ha olyan számítógépen próbál CTaskDialog használni, amely nem támogatja a CTaskDialog osztályt.

Példa

// TODO: Replace the string below with the actual message to the user
CString message("Important information to the user");
// TODO: Replace the string below with the title of this project
CString title("Project Title");

CString emptyString;

if (CTaskDialog::IsSupported())
{
   CTaskDialog::ShowDialog(message, emptyString, title, 0, 0,
                           TDCBF_OK_BUTTON);
}
else
{
   AfxMessageBox(message);
}

CTaskDialog::LoadCommandControls

A parancsgomb vezérlőit a sztringtáblából származó adatokkal adja hozzá.

void LoadCommandControls(
    int nIDCommandControlsFirst,
    int nIDCommandControlsLast);

Paraméterek

nIDCommandControlsFirst
[in] Az első parancs sztringazonosítója.

nIDCommandControlsLast
[in] Az utolsó parancs sztringazonosítója.

Megjegyzések

Ez a metódus parancsgomb-vezérlőket hoz létre az alkalmazás erőforrásfájljából származó adatok használatával. Az erőforrásfájl sztringtáblája több sztringgel és társított karakterláncazonosítóval rendelkezik. Az ezzel a módszerrel hozzáadott új parancsgomb-vezérlők a vezérlő feliratának sztringjét és a vezérlő azonosítójának sztringazonosítóját használják. A kijelölt sztringek tartományát nIDCommandControlsFirst és nCommandControlsLastbiztosítja, beleértve. Ha a tartomány egy üres bejegyzést tartalmaz, a metódus nem ad hozzá parancsgomb-vezérlőt a bejegyzéshez.

Alapértelmezés szerint az új parancsgomb-vezérlők engedélyezve vannak, és nem igényelnek jogosultságszint-emelést.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title.
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::LoadRadioButtons

A sztringtáblából származó adatokkal adja hozzá a választógomb vezérlőit.

void LoadRadioButtons(
    int nIDRadioButtonsFirst,
    int nIDRadioButtonsLast);

Paraméterek

nIDRadioButtonsFirst
[in] Az első választógomb sztringazonosítója.

nIDRadioButtonsLast
[in] Az utolsó választógomb sztringazonosítója.

Megjegyzések

Ez a módszer rádiógombokat hoz létre az alkalmazás erőforrásfájljából származó adatok használatával. Az erőforrásfájl sztringtáblája több sztringgel és társított karakterláncazonosítóval rendelkezik. Az ezzel a módszerrel hozzáadott új választógombok a választógomb feliratának sztringjét és a választógomb azonosítójának sztringazonosítóját használják. A kijelölt sztringek tartományát nIDRadioButtonsFirst és nRadioButtonsLastadja meg, beleértve. Ha a tartomány egy üres bejegyzést tartalmaz, a metódus nem ad hozzá választógombot a bejegyzéshez.

Alapértelmezés szerint az új választógombok engedélyezve vannak.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

Áthelyezi a fókuszt egy másik CTaskDialog.

protected:
void NavigateTo(CTaskDialog& oTaskDialog) const;

Paraméterek

oTaskDialog
[in] A fókuszt fogadó CTaskDialog.

Megjegyzések

Ez a metódus elrejti az aktuális CTaskDialog, amikor megjeleníti az oTaskDialog . Az oTaskDialog az aktuális CTaskDialogazonos helyen jelenik meg.

CTaskDialog::OnCommandControlClick

A keretrendszer meghívja ezt a metódust, amikor a felhasználó egy parancsgomb vezérlőelemére kattint.

virtual HRESULT OnCommandControlClick(int nCommandControlID);

Paraméterek

nCommandControlID
[in] A felhasználó által kiválasztott parancsgomb azonosítója.

Visszaadott érték

Az alapértelmezett implementáció S_OK ad vissza.

Megjegyzések

Felülbírálja ezt a metódust egy származtatott osztályban az egyéni viselkedés implementálásához.

CTaskDialog::OnCreate

A keretrendszer a CTaskDialoglétrehozása után meghívja ezt a metódust.

virtual HRESULT OnCreate();

Visszaadott érték

Az alapértelmezett implementáció S_OK ad vissza.

Megjegyzések

Felülbírálja ezt a metódust egy származtatott osztályban az egyéni viselkedés implementálásához.

CTaskDialog::OnDestroy

A keretrendszer ezt a metódust közvetlenül azelőtt hívja meg, hogy megsemmisítené a CTaskDialog.

virtual HRESULT OnDestroy();

Visszaadott érték

Az alapértelmezett implementáció S_OK ad vissza.

Megjegyzések

Felülbírálja ezt a metódust egy származtatott osztályban az egyéni viselkedés implementálásához.

CTaskDialog::OnExpandButtonClick

A keretrendszer meghívja ezt a metódust, amikor a felhasználó a bővítő gombra kattint.

virtual HRESULT OnExpandButtonClicked(BOOL bExpanded);

Paraméterek

bExpanded
[in] A nemero érték azt jelzi, hogy a további információk megjelennek; A 0 azt jelzi, hogy a további információk rejtettek.

Visszaadott érték

Az alapértelmezett implementáció S_OK ad vissza.

Megjegyzések

Felülbírálja ezt a metódust egy származtatott osztályban az egyéni viselkedés implementálásához.

CTaskDialog::OnHelp

A keretrendszer meghívja ezt a metódust, amikor a felhasználó segítséget kér.

virtual HRESULT OnHelp();

Visszaadott érték

Az alapértelmezett implementáció S_FALSE ad vissza.

Megjegyzések

Felülbírálja ezt a metódust egy származtatott osztályban az egyéni viselkedés implementálásához.

CTaskDialog::OnHyperlinkClick

A keretrendszer meghívja ezt a metódust, amikor a felhasználó egy hivatkozásra kattint.

virtual HRESULT OnHyperlinkClick(const CString& strHref);

Paraméterek

strHref
[in] A hivatkozást jelképező sztring.

Visszaadott érték

Az alapértelmezett implementáció S_OK ad vissza.

Megjegyzések

Ez a metódus meghívja ShellExecute, mielőtt visszaadja S_OK.

Felülbírálja ezt a metódust egy származtatott osztályban az egyéni viselkedés implementálásához.

CTaskDialog::OnInit

A keretrendszer ezt a metódust a CTaskDialog inicializálásakor hívja meg.

virtual HRESULT OnInit();

Visszaadott érték

Az alapértelmezett implementáció S_OK ad vissza.

Megjegyzések

Felülbírálja ezt a metódust egy származtatott osztályban az egyéni viselkedés implementálásához.

CTaskDialog::OnNavigatePage

A keretrendszer ezt a metódust a következő CTaskDialog::NavigateTo metódusra válaszul hívja meg.

virtual HRESULT OnNavigatePage();

Visszaadott érték

Az alapértelmezett implementáció S_OK ad vissza.

Megjegyzések

Felülbírálja ezt a metódust egy származtatott osztályban az egyéni viselkedés implementálásához.

CTaskDialog::OnRadioButtonClick

A keretrendszer meghívja ezt a metódust, amikor a felhasználó kiválaszt egy választógomb-vezérlőt.

virtual HRESULT OnRadioButtonClick(int nRadioButtonID);

Paraméterek

nRadioButtonID
[in] A választógomb azonosítója határozza meg, hogy a felhasználó rákattintott-e.

Visszaadott érték

Az alapértelmezett implementáció S_OK ad vissza.

Megjegyzések

Felülbírálja ezt a metódust egy származtatott osztályban az egyéni viselkedés implementálásához.

CTaskDialog::OnTimer

A keretrendszer ezt a metódust hívja meg az időzítő lejáratakor.

virtual HRESULT OnTimer(long lTime);

Paraméterek

lTime
[in] A CTaskDialog létrehozása vagy az időzítő alaphelyzetbe állítása óta eltelt idő ezredmásodpercben.

Visszaadott érték

Az alapértelmezett implementáció S_OK ad vissza.

Megjegyzések

Felülbírálja ezt a metódust egy származtatott osztályban az egyéni viselkedés implementálásához.

CTaskDialog::OnVerificationCheckboxClick

A keretrendszer meghívja ezt a metódust, amikor a felhasználó az ellenőrző jelölőnégyzetre kattint.

virtual HRESULT OnVerificationCheckboxClick(BOOL bChecked);

Paraméterek

b Bejelölt
[in] A TRUE (IGAZ) érték azt jelzi, hogy az ellenőrzés jelölőnégyzet be van jelölve; A HAMIS azt jelzi, hogy nem.

Visszaadott érték

Az alapértelmezett implementáció S_OK ad vissza.

Megjegyzések

Felülbírálja ezt a metódust egy származtatott osztályban az egyéni viselkedés implementálásához.

CTaskDialog::RemoveAllCommandControls

Eltávolítja az összes parancsgomb-vezérlőt a CTaskDialog.

void RemoveAllCommandControls();

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title.
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::RemoveAllRadioButtons

Eltávolítja az összes választógombot a CTaskDialog.

void RemoveAllRadioButtons();

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

CTaskDialog::SetCommandControlOptions

A parancsgomb vezérlőjének frissítése a CTaskDialog.

void SetCommandControlOptions(
    int nCommandControlID,
    BOOL bEnabled,
    BOOL bRequiresElevation = FALSE);

Paraméterek

nCommandControlID
[in] A frissíteni kívánt parancsvezérlő azonosítója.

bEnabled
[in] Logikai paraméter, amely jelzi, hogy a megadott parancsgomb vezérlőelem engedélyezve van-e vagy le van-e tiltva.

bRequiresElevation
[in] Logikai paraméter, amely azt jelzi, hogy a megadott parancsgomb-vezérlő emelést igényel-e.

Megjegyzések

Ezzel a módszerrel módosíthatja, hogy a parancsgomb vezérlőelem engedélyezve van-e, vagy emelést igényel, miután hozzáadta a CTaskDialog osztályhoz.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title.
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::SetCommonButtonOptions

Frissíti a gyakori gombok egy részhalmazát, hogy engedélyezve legyen és UAC-jogosultságszint-emelést igényeljen.

void SetCommonButtonOptions(
    int nDisabledButtonMask,
    int nElevationButtonMask = 0);

Paraméterek

nDisabledButtonMask
[in] Maszk a letiltandó gyakori gombokhoz.

nElevationButtonMask
[in] Maszk a gyakori, emelést igénylő gombokhoz.

Megjegyzések

A CTaskDialog osztály egy példánya számára elérhető általános gombokat a CTaskDialog::CTaskDialog konstruktor és a CTaskDialog::SetCommonButtons metódus. CTaskDialog::SetCommonButtonOptions nem támogatja az új gyakori gombok hozzáadását.

Ha ezzel a módszerrel tiltja le vagy emeli fel az ehhez a CTaskDialognem elérhető általános gombot, ez a metódus kivételt jelez a ENSURE makró használatával.

Ez a módszer lehetővé teszi a CTaskDialog számára elérhető, de nem a nDisabledButtonMaskgombot, még akkor is, ha korábban le volt tiltva. Ez a módszer hasonló módon kezeli a szintemelkedést: a gyakori gombokat úgy rögzíti, hogy nem igényel emelést, ha a közös gomb elérhető, de nem szerepel nElevationButtonMask.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title);

// Create a button mask.
int buttons = TDCBF_OK_BUTTON | TDCBF_CANCEL_BUTTON;
buttons |= TDCBF_RETRY_BUTTON | TDCBF_CLOSE_BUTTON;

taskDialog.SetCommonButtons(buttons);

// Disable the close button and make the retry button require
// elevation.
taskDialog.SetCommonButtonOptions(TDCBF_CLOSE_BUTTON,
                                  TDCBF_RETRY_BUTTON);

taskDialog.DoModal();

CTaskDialog::SetCommonButtons

Általános gombokat ad hozzá a CTaskDialog.

void SetCommonButtons(
    int nButtonMask,
    int nDisabledButtonMask = 0,
    int nElevationButtonMask = 0);

Paraméterek

nButtonMask
[in] A CTaskDialoghozzáadni kívánt gombok maszkja.

nDisabledButtonMask
[in] A letiltani kívánt gombok maszkja.

nElevationButtonMask
[in] A jogosultságszint-emelést igénylő gombok maszkja.

Megjegyzések

Ezt a metódust nem hívhatja meg a CTaskDialog osztály jelen példányának megjelenítési ablaka létrehozása után. Ha igen, ez a metódus kivételt eredményez.

A nButtonMask által jelzett gombok felülbírálják a CTaskDialogkorábban hozzáadott gyakori gombokat. Csak a nButtonMask gombjai érhetők el.

Ha nDisabledButtonMask vagy nElevationButtonMask olyan gombot tartalmaz, amely nem szerepel nButtonMask, ez a metódus kivételt jelez a ENSURE makróval.

Alapértelmezés szerint az összes gyakori gomb engedélyezve van, és nem igényel jogosultságszint-emelést.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title);

// Create a button mask.
int buttons = TDCBF_OK_BUTTON | TDCBF_CANCEL_BUTTON;
buttons |= TDCBF_RETRY_BUTTON | TDCBF_CLOSE_BUTTON;

taskDialog.SetCommonButtons(buttons);

// Disable the close button and make the retry button require
// elevation.
taskDialog.SetCommonButtonOptions(TDCBF_CLOSE_BUTTON,
                                  TDCBF_RETRY_BUTTON);

taskDialog.DoModal();

CTaskDialog::SetContent

Frissíti a CTaskDialogtartalmát.

void SetContent(const CString& strContent);

Paraméterek

strContent
[in] A felhasználó számára megjelenítendő sztring.

Megjegyzések

A CTaskDialog osztály tartalma az a szöveg, amely a párbeszédpanel fő szakaszában jelenik meg a felhasználó számára.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::SetDefaultCommandControl

Megadja az alapértelmezett parancsgomb-vezérlőt.

void SetDefaultCommandControl(int nCommandControlID);

Paraméterek

nCommandControlID
[in] A parancsgomb vezérlőjének azonosítója legyen az alapértelmezett.

Megjegyzések

Az alapértelmezett parancsgomb vezérlőelem az a vezérlő, amely akkor van kiválasztva, amikor a CTaskDialog először megjelenik a felhasználó számára.

Ez a metódus kivételt eredményez, ha nem találja az nCommandControlIDáltal megadott parancsgomb-vezérlőt.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title.
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::SetDefaultRadioButton

Az alapértelmezett választógombot adja meg.

void SetDefaultRadioButton(int nRadioButtonID);

Paraméterek

nRadioButtonID
[in] A választógomb alapértelmezett azonosítója.

Megjegyzések

Az alapértelmezett választógomb az a gomb, amely akkor van kiválasztva, amikor a CTaskDialog először megjelenik a felhasználó számára.

Ez a metódus kivételt eredményez, ha nem találja a nRadioButtonIDáltal megadott választógombot.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

CTaskDialog::SetDialogWidth

A CTaskDialogszélességének beállítása.

void SetDialogWidth(int nWidth = 0);

Paraméterek

nWidth
[in] A párbeszédpanel szélessége képpontban.

Megjegyzések

Az nWidth paraméternek 0-nál nagyobbnak vagy egyenlőnek kell lennie. Ellenkező esetben ez a metódus kivételt jelez.

Ha nWidth értéke 0, ez a metódus az alapértelmezett méretre állítja a párbeszédpanelt.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::SetExpansionArea

Frissíti a CTaskDialogbővítőterületét.

void SetExpansionArea(
    const CString& strExpandedInformation,
    const CString& strCollapsedLabel = _T(""),
    const CString& strExpandedLabel = _T(""));

Paraméterek

strExpandedInformation
[in] Az a sztring, amelyet a CTaskDialog a párbeszédpanel törzsében jelenít meg, amikor a felhasználó a bővítő gombra kattint.

strCollapsedLabel
[in] Az a sztring, amelyet a CTaskDialog a kibontott terület összecsukásakor a bővítés gomb mellett jelenít meg.

strExpandedLabel
[in] Az a sztring, amelyet a CTaskDialog a kibontott terület megjelenítésekor a bővítés gomb mellett jelenít meg.

Megjegyzések

A CTaskDialog osztály bővítőterületével további információkat adhat meg a felhasználónak. A bővítési terület a CTaskDialogfő részén található, közvetlenül a cím és a tartalom sztringje alatt.

A CTaskDialog első megjelenésekor nem jeleníti meg a kibontott információkat, és strCollapsedLabel a bővítőgomb mellett helyezi el. Amikor a felhasználó a bővítő gombra kattint, a CTaskDialog megjelenik strExpandedInformation, és a címkét strExpandedLabelértékre módosítja.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::SetFooterIcon

Frissíti a CTaskDialogélőláb ikonját.

void SetFooterIcon(HICON hFooterIcon);
void SetFooterIcon(LPCWSTR lpszFooterIcon);

Paraméterek

hFooterIcon
[in] A CTaskDialogúj ikonja.

lpszFooterIcon
[in] A CTaskDialogúj ikonja.

Megjegyzések

Az élőláb ikon a CTaskDialog osztályalján jelenik meg. Az élőlábhoz társított szöveg is lehet. Az élőláb szövegét a következővel módosíthatja: CTaskDialog::SetFooterText.

Ez a metódus kivételt jelent a GYŐZŐDJÖN meg makróról, ha a CTaskDialog megjelenik, vagy a bemeneti paraméter NULL.

A CTaskDialog csak HICON vagy LPCWSTR fogadhatnak el láblécikonként. Ezt úgy konfigurálja, hogy a konstruktorban vagy CTaskDialog::SetOptionsbeállítással TDF_USE_HICON_FOOTER. Alapértelmezés szerint a CTaskDialog úgy van konfigurálva, hogy LPCWSTR használja az élőláb ikonjának bemeneti típusaként. Ez a metódus kivételt okoz, ha nem megfelelő típussal próbálja beállítani az ikont.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::SetFooterText

Frissíti a CTaskDialogláblécének szövegét.

void SetFooterText(const CString& strFooterText);

Paraméterek

strFooterText
[in] Az élőláb új szövege.

Megjegyzések

Az élőláb ikonja a CTaskDialogalján lévő élőlábszöveg mellett jelenik meg. Az élőláb ikont a CTaskDialog::SetFooterIconhasználatával módosíthatja.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::SetMainIcon

Frissíti a CTaskDialogfő ikonját.

void SetMainIcon(HICON hMainIcon);
void SetMainIcon(LPCWSTR lpszMainIcon);

Paraméterek

hMainIcon
[in] Az új ikon.

lpszMainIcon
[in] Az új ikon.

Megjegyzések

Ez a metódus kivételt jelent a GYŐZŐDJÖN meg makróról, ha a CTaskDialog megjelenik, vagy a bemeneti paraméter NULL.

A CTaskDialog csak egy HICON vagy LPCWSTR fogadhatnak el fő ikonként. Ezt úgy konfigurálhatja, hogy a konstruktorban vagy a CTaskDialog::SetOptions metódusban adja meg a TDF_USE_HICON_MAIN beállítást. Alapértelmezés szerint a CTaskDialog úgy van konfigurálva, hogy a főikon bemeneti típusa LPCWSTR legyen. Ez a metódus kivételt okoz, ha nem megfelelő típussal próbálja beállítani az ikont.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::SetMainInstruction

Frissíti a CTaskDialogfő utasítását.

void SetMainInstruction(const CString& strInstructions);

Paraméterek

strInstructions
[in] Az új fő utasítás.

Megjegyzések

A CTaskDialog osztály fő utasítása a felhasználó számára nagy félkövér betűtípussal megjelenített szöveg. A címsáv alatti párbeszédpanelen található.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::SetOptions

Konfigurálja a CTaskDialogbeállításait.

void SetOptions(int nOptionFlag);

Paraméterek

nOptionFlag
[in] A CTaskDialoghasználandó jelzők készlete.

Megjegyzések

Ez a metódus törli a CTaskDialogaktuális beállításait. Az aktuális beállítások megőrzéséhez először le kell kérnie őket CTaskDialog::GetOptions, és kombinálnia kell őket a beállítani kívánt beállításokkal.

Az alábbi táblázat az összes érvényes beállítást felsorolja.

Név Leírás
TDF_ENABLE_HYPERLINKS Engedélyezi a hivatkozásokat a CTaskDialog.
TDF_USE_HICON_MAIN A CTaskDialog úgy konfigurálja, hogy a főikonhoz HICON használjon. A másik lehetőség egy LPCWSTRhasználata.
TDF_USE_HICON_FOOTER A CTaskDialog úgy konfigurálja, hogy HICON használjon az élőláb ikonhoz. A másik lehetőség egy LPCWSTRhasználata.
TDF_ALLOW_DIALOG_CANCELLATION Lehetővé teszi a felhasználó számára a CTaskDialog bezárását a billentyűzet vagy a párbeszédpanel jobb felső sarkában lévő ikon használatával, még akkor is, ha a Mégse gomb nincs engedélyezve. Ha ez a jelző nincs beállítva, és a Mégse gomb nincs engedélyezve, a felhasználó nem tudja bezárni a párbeszédpanelt az Alt+F4 billentyű, az Escape billentyű vagy a címsor bezárás gombjával.
TDF_USE_COMMAND_LINKS A parancsgomb-vezérlők használatára konfigurálja a CTaskDialog.
TDF_USE_COMMAND_LINKS_NO_ICON A CTaskDialog úgy konfigurálja, hogy parancsgomb-vezérlőket használjon anélkül, hogy ikont jelenítenének meg a vezérlő mellett. TDF_USE_COMMAND_LINKS felülbírálja TDF_USE_COMMAND_LINKS_NO_ICON.
TDF_EXPAND_FOOTER_AREA Azt jelzi, hogy a bővítési terület jelenleg ki van bontva.
TDF_EXPANDED_BY_DEFAULT Meghatározza, hogy a bővítési terület alapértelmezés szerint ki van-e bontva.
TDF_VERIFICATION_FLAG_CHECKED Azt jelzi, hogy az ellenőrzési jelölőnégyzet jelenleg be van jelölve.
TDF_SHOW_PROGRESS_BAR Konfigurálja a CTaskDialog egy folyamatjelző sáv megjelenítéséhez.
TDF_SHOW_MARQUEE_PROGRESS_BAR Úgy konfigurálja a folyamatjelző sávot, hogy egy kijelölési folyamatjelző legyen. Ha engedélyezi ezt a beállítást, be kell állítania TDF_SHOW_PROGRESS_BAR a várt viselkedésre.
TDF_CALLBACK_TIMER Azt jelzi, hogy a CTaskDialog visszahívási időköz körülbelül 200 ezredmásodpercre van beállítva.
TDF_POSITION_RELATIVE_TO_WINDOW A CTaskDialog a szülőablakhoz viszonyítva középre állítja. Ha ez a jelző nincs engedélyezve, a CTaskDialog a figyelőhöz viszonyítva középre van állítva.
TDF_RTL_LAYOUT A jobbról balra olvasási elrendezéshez konfigurálja a CTaskDialog.
TDF_NO_DEFAULT_RADIO_BUTTON Azt jelzi, hogy a CTaskDialog megjelenésekor nincs választógomb kijelölve.
TDF_CAN_BE_MINIMIZED Lehetővé teszi a felhasználó számára a CTaskDialogminimalizálását. A beállítás támogatásához a CTaskDialog nem lehet modális. Az MFC nem támogatja ezt a lehetőséget, mert az MFC nem támogatja a mód nélküli CTaskDialog.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::SetProgressBarMarquee

Konfigurál egy sávot a CTaskDialog, és hozzáadja a párbeszédpanelhez.

void SetProgressBarMarquee(
    BOOL bEnabled = TRUE,
    int nMarqueeSpeed = 0);

Paraméterek

bEnabled
[in] IGAZ a kijelölési sáv engedélyezéséhez; HAMIS a kijelölősáv letiltásához és a CTaskDialogeltávolításához.

nMarqueeSpeed
[in] A sáv sebességét jelző egész szám.

Megjegyzések

A kijelölési sáv a CTaskDialog osztály főszövege alatt jelenik meg.

Használja nMarqueeSpeed a sáv sebességének beállításához; nagyobb értékek lassabb sebességet jeleznek. Az nMarqueeSpeed értéke 0, így a kijelölési sáv a Windows alapértelmezett sebességén mozog.

Ez a módszer kivételt jelent a GYŐZŐDJÖN meg makróról, ha nMarqueeSpeed kisebb, mint 0.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Add a marquee progress bar.
taskDialog.SetProgressBarMarquee();

taskDialog.DoModal();

// Remove the marquee bar and replace it with a standard progress bar
taskDialog.SetProgressBarMarquee(0);
taskDialog.SetProgressBarRange(0, 100);
taskDialog.SetProgressBarPosition(75);
taskDialog.SetProgressBarState();

taskDialog.DoModal();

CTaskDialog::SetProgressBarPosition

Beállítja a folyamatjelző sáv pozícióját.

void SetProgressBarPosition(int nProgressPos);

Paraméterek

nProgressPos
[in] A folyamatjelző sáv pozíciója.

Megjegyzések

Ez a módszer kivételt jelent a GYŐZŐDJÖN meg makróról, ha nProgressPos nincs a folyamatjelző sáv tartományában. A folyamatjelző sáv tartományát a következővel módosíthatja: CTaskDialog::SetProgressBarRange.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Add a marquee progress bar.
taskDialog.SetProgressBarMarquee();

taskDialog.DoModal();

// Remove the marquee bar and replace it with a standard progress bar
taskDialog.SetProgressBarMarquee(0);
taskDialog.SetProgressBarRange(0, 100);
taskDialog.SetProgressBarPosition(75);
taskDialog.SetProgressBarState();

taskDialog.DoModal();

CTaskDialog::SetProgressBarRange

A folyamatjelző sáv tartományának beállítása.

void SetProgressBarRange(
    int nRangeMin,
    int nRangeMax);

Paraméterek

nRangeMin
[in] A folyamatjelző sáv alsó határa.

nRangeMax
[in] A folyamatjelző sáv felső határa.

Megjegyzések

A folyamatjelző sáv pozíciója nRangeMin és nRangeMax. Ha például nRangeMin 50, és nRangeMax 100, a 75-ös pozíció félúton van a folyamatjelző sávon. Használja CTaskDialog::SetProgressBarPosition a folyamatjelző sáv pozíciójának beállításához.

Az állapotsor megjelenítéséhez engedélyezni kell a TDF_SHOW_PROGRESS_BAR beállítást, és TDF_SHOW_MARQUEE_PROGRESS_BAR nem szabad engedélyezni. Ez a metódus automatikusan beállítja TDF_SHOW_PROGRESS_BAR, és törli a TDF_SHOW_MARQUEE_PROGRESS_BAR. A CTaskDialog::SetOptions használatával manuálisan módosíthatja a CTaskDialog osztályezen példányának beállításait.

Ez a metódus kivételt jelent a ENSURE makróval, ha nRangeMin nem kisebb, mint nRangeMax. Ez a metódus akkor is kivételt eredményez, ha a CTaskDialog már megjelenik, és van egy kijelölési folyamatjelző sávja.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Add a marquee progress bar.
taskDialog.SetProgressBarMarquee();

taskDialog.DoModal();

// Remove the marquee bar and replace it with a standard progress bar
taskDialog.SetProgressBarMarquee(0);
taskDialog.SetProgressBarRange(0, 100);
taskDialog.SetProgressBarPosition(75);
taskDialog.SetProgressBarState();

taskDialog.DoModal();

CTaskDialog::SetProgressBarState

Beállítja a folyamatjelző sáv állapotát, és megjeleníti az CTaskDialog.

void SetProgressBarState(int nState = PBST_NORMAL);

Paraméterek

nState
[in] A folyamatjelző sáv állapota. A lehetséges értékekért tekintse meg a Megjegyzések szakaszt.

Megjegyzések

Ez a metódus kivételt jelent a GYŐZŐDjön meg makróról, ha a CTaskDialog már megjelenik, és van egy kijelölési folyamatjelző sávja.

Az alábbi táblázat az nStatelehetséges értékeit sorolja fel. Ezekben az esetekben a folyamatjelző sáv megtelik a normál színnel, amíg el nem éri a kijelölt leállítási pozíciót. Ekkor az állapottól függően megváltozik a szín.

Név Leírás
PBST_NORMAL A folyamatjelző sáv kitöltése után a CTaskDialog nem módosítja a sáv színét. Alapértelmezés szerint a normál szín zöld.
PBST_ERROR A folyamatjelző sáv kitöltése után a CTaskDialog hibaszínre módosítja a sáv színét. Alapértelmezés szerint ez piros.
PBST_PAUSED A folyamatjelző sáv kitöltése után a CTaskDialog a sáv színét a szüneteltetett színre módosítja. Alapértelmezés szerint ez sárga.

A CTaskDialog::SetProgressBarPosition beállításával beállíthatja, hogy a folyamatjelzőhol áll le.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Add a marquee progress bar.
taskDialog.SetProgressBarMarquee();

taskDialog.DoModal();

// Remove the marquee bar and replace it with a standard progress bar
taskDialog.SetProgressBarMarquee(0);
taskDialog.SetProgressBarRange(0, 100);
taskDialog.SetProgressBarPosition(75);
taskDialog.SetProgressBarState();

taskDialog.DoModal();

CTaskDialog::SetRadioButtonOptions

Engedélyezi vagy letiltja a választógombot.

void SetRadioButtonOptions(
    int nRadioButtonID,
    BOOL bEnabled);

Paraméterek

nRadioButtonID
[in] A választógomb-vezérlő azonosítója.

bEnabled
[in] IGAZ a választógomb engedélyezéséhez; HAMIS a választógomb letiltásához.

Megjegyzések

Ez a módszer kivételt jelent a GYŐZŐDJÖN meg makróról, ha nRadioButtonID nem érvényes azonosító egy választógombhoz.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

CTaskDialog::SetVerificationCheckbox

Az ellenőrző jelölőnégyzet bejelölt állapotát állítja be.

void SetVerificationCheckbox(BOOL bChecked);

Paraméterek

b Bejelölt
[in] IGAZ, ha az ellenőrző jelölőnégyzet be van jelölve a CTaskDialog megjelenésekor; HAMIS, ha az ellenőrző jelölőnégyzet nincs bejelölve a CTaskDialog megjelenésekor.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Add the verification checkbox and set the default state.
taskDialog.SetVerificationCheckboxText(L"Remember your selection.");
taskDialog.SetVerificationCheckbox(false);

taskDialog.DoModal();

if (taskDialog.GetVerificationCheckboxState())
{
   // TODO: Write settings of the task dialog to the registry
}

CTaskDialog::SetVerificationCheckboxText

Beállítja az ellenőrző jelölőnégyzet jobb oldalán megjelenő szöveget.

void SetVerificationCheckboxText(CString& strVerificationText);

Paraméterek

strVerificationText
[in] A metódus által az ellenőrzési jelölőnégyzet mellett megjelenő szöveg.

Megjegyzések

Ez a metódus kivételt jelent a ENSURE makróval, ha a CTaskDialog osztály ezen példánya már megjelenik.

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Add the verification checkbox and set the default state.
taskDialog.SetVerificationCheckboxText(L"Remember your selection.");
taskDialog.SetVerificationCheckbox(false);

taskDialog.DoModal();

if (taskDialog.GetVerificationCheckboxState())
{
   // TODO: Write settings of the task dialog to the registry
}

CTaskDialog::SetWindowTitle

A CTaskDialogcímét állítja be.

void SetWindowTitle(CString& strWindowTitle);

Paraméterek

strWindowTitle
[in] A CTaskDialogúj címe.

Megjegyzések

Példa

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::ShowDialog

Létrehoz és megjelenít egy CTaskDialog.

static INT_PTR ShowDialog(
    const CString& strContent,
    const CString& strMainInstruction,
    const CString& strTitle,
    int nIDCommandControlsFirst,
    int nIDCommandControlsLast,
    int nCommonButtons = TDCBF_YES_BUTTON | TDCBF_NO_BUTTON,
    int nTaskDialogOptions = TDF_ENABLE_HYPERLINKS | TDF_USE_COMMAND_LINKS,
    const CString& strFooter = _T(""));

Paraméterek

strContent
[in] A CTaskDialogtartalmához használandó sztring.

strMainInStruction
[in] A CTaskDialogfő utasítása.

strTitle
[in] A CTaskDialogcíme.

nIDCommandControlsFirst
[in] Az első parancs sztringazonosítója.

nIDCommandControlsLast
[in] Az utolsó parancs sztringazonosítója.

nCommonButtons
[in] A CTaskDialoghozzáadni kívánt gombok maszkja.

nTaskDialogOptions
[in] A CTaskDialoghasználható beállítások készlete.

strFooter
[in] Az élőlábként használni kívánt sztring.

Visszaadott érték

A felhasználó által megadott kijelölésnek megfelelő egész szám.

Megjegyzések

Ez a statikus módszer lehetővé teszi, hogy a CTaskDialog osztály egy példányát anélkül hozza létre, hogy explicit módon létrehoz egy CTaskDialog objektumot a kódban. Mivel nincs CTaskDialog objektum, a CTaskDialog más metódusait nem hívhatja meg, ha ezzel a módszerrel CTaskDialog jelenít meg a felhasználónak.

Ez a metódus parancsgomb-vezérlőket hoz létre az alkalmazás erőforrásfájljából származó adatok használatával. Az erőforrásfájl sztringtáblája több sztringgel és társított karakterláncazonosítóval rendelkezik. Ez a metódus egy parancsgomb-vezérlőt ad hozzá a sztringtáblában lévő összes érvényes bejegyzéshez az nIDCommandControlsFirst és nCommandControlsLastközött, beleértve azokat is. A parancsgomb vezérlőinél a sztringtáblában lévő sztring a vezérlő felirata, a sztringazonosító pedig a vezérlő azonosítója.

Az érvényes beállítások listáját a CTaskDialog::SetOptions című témakörben találja.

A CTaskDialog bezárul, amikor a felhasználó kiválaszt egy közös gombot, egy parancshivatkozás-vezérlőt, vagy bezárja a CTaskDialog. A visszatérési érték az az azonosító, amely jelzi, hogy a felhasználó hogyan zárta be a párbeszédpanelt.

Példa

// TODO: Replace the string below with the actual message to the user
CString message("Important information to the user");
// TODO: Replace the string below with the title of this project
CString title("Project Title");

CString emptyString;

if (CTaskDialog::IsSupported())
{
   CTaskDialog::ShowDialog(message, emptyString, title, 0, 0,
                           TDCBF_OK_BUTTON);
}
else
{
   AfxMessageBox(message);
}

CTaskDialog::TaskDialogCallback

A keretrendszer ezt a metódust különböző Windows-üzenetekre válaszul hívja meg.

friend:
HRESULT TaskDialogCallback(
    HWND hWnd,
    UINT uNotification,
    WPARAM wParam,
    LPARAM lParam,
    LONG_PTR dwRefData);

Paraméterek

hwnd
[in] A CTaskDialogm_hWnd szerkezetének leírója.

uNotification
[in] A létrehozott üzenetet meghatározó értesítési kód.

wParam
[in] További információ az üzenetről.

lParam
[in] További információ az üzenetről.

dwRefData
[in] A visszahívási üzenet által érintett CTaskDialog objektumra mutató mutató.

Visszaadott érték

Az adott értesítési kódtól függ. További információért tekintse meg a Megjegyzések szakaszt.

Megjegyzések

A TaskDialogCallback alapértelmezett implementációja kezeli az adott üzenetet, majd meghívja a megfelelő On metódust a CTaskDialog Osztály. A TDN_BUTTON_CLICKED üzenetre válaszul például TaskDialogCallback meghívja CTaskDialog::OnCommandControlClick.

A wParam és lParam értékei az adott létrehozott üzenettől függenek. Előfordulhat, hogy mindkét érték üres. Az alábbi táblázat felsorolja a támogatott alapértelmezett értesítéseket, valamint a wParam és lParam értékeit. Ha egy származtatott osztályban felülbírálja ezt a metódust, az alábbi táblázatban minden egyes üzenethez implementálnia kell a visszahívási kódot.

Értesítési üzenet wParam Érték lParam Érték
TDN_CREATED Nincs használatban. Nincs használatban.
TDN_NAVIGATED Nincs használatban. Nincs használatban.
TDN_BUTTON_CLICKED A parancsgomb vezérlőazonosítója. Nincs használatban.
TDN_HYPERLINK_CLICKED Nincs használatban. A hivatkozást tartalmazó LPCWSTR struktúra.
TDN_TIMER A CTaskDialog létrehozása vagy az időzítő alaphelyzetbe állítása óta eltelt idő ezredmásodpercben. Nincs használatban.
TDN_DESTROYED Nincs használatban. Nincs használatban.
TDN_RADIO_BUTTON_CLICKED A választógomb azonosítója. Nincs használatban.
TDN_DIALOG_CONSTRUCTED Nincs használatban. Nincs használatban.
TDN_VERIFICATION_CLICKED 1, ha a jelölőnégyzet be van jelölve, 0, ha nem. Nincs használatban.
TDN_HELP Nincs használatban. Nincs használatban.
TDN_EXPANDO_BUTTON_CLICKED 0, ha a bővítési terület össze van csukva; nonzero értékre, ha a bővítőszöveg megjelenik. Nincs használatban.

Lásd még:

osztályok
CObject osztály
hierarchiadiagram
útmutató: CTaskDialog hozzáadása alkalmazáshoz