Click here to Skip to main content
15,905,877 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralGetFolderFromID() from Namespace Pin
johnxx3-Nov-03 6:47
johnxx3-Nov-03 6:47 
GeneralDefault name file in serialization Pin
doctorpi3-Nov-03 5:37
doctorpi3-Nov-03 5:37 
GeneralRe: Default name file in serialization Pin
Markyg3-Nov-03 10:34
Markyg3-Nov-03 10:34 
Generalvector and delete Pin
ns3-Nov-03 5:32
ns3-Nov-03 5:32 
GeneralRe: vector and delete Pin
valikac3-Nov-03 5:44
valikac3-Nov-03 5:44 
GeneralRe: vector and delete Pin
ns3-Nov-03 5:54
ns3-Nov-03 5:54 
GeneralRe: vector and delete Pin
jhwurmbach3-Nov-03 6:32
jhwurmbach3-Nov-03 6:32 
GeneralRe: vector and delete Pin
ns3-Nov-03 7:52
ns3-Nov-03 7:52 
I push_back m_pDLGSettings onto the vector. Then I get rid of it as below . Then I test it:

void CImageDisplay::OnBsettings()
{
m_pDlgSettings = new CDlgSettings ;

if (m_pDlgSettings == NULL) return;

BOOL ret = m_pDlgSettings->Create(IDD_DLGSETTINGS, this);

m_pDlgSettings->ShowWindow(SW_SHOW);

pDlgSettingsVector.push_back(m_pDlgSettings);

m_bSettings.EnableWindow(FALSE);



}
In another place where I want all windows to destroy and zero out:

    if( pDlgSettingsVector.size())
    {
        for (int i =0; i < pDlgSettingsVector.size(); i++)
        {
            pDlgSettingsVector[i]->DestroyWindow();
            delete pDlgSettingsVector[i];
            pDlgSettingsVector[i]=0;
}

        pDlgSettingsVector.clear();
    }


and in a function of the class that the index [i] refers to:

if (!m_pDlgSettings)
{
    m_bSettings.EnableWindow(TRUE);
}


I didnt use the vector here because I dont have the location of the pointer in that vector at this point in code. Instead I access it directly, feeling assured that Ithough deleted it using an index, I can always use it by its name instead of its position in the vector. (m_pDLgSettings is a member). In the place I want to check it (last snippet) I am not using its vector position but its actual variable that I pushed onto the vector..........

Hope I am not hopelessly unclear....
Smile | :)
Thanks,
ns
GeneralRe: vector and delete Pin
TFrancis3-Nov-03 8:42
TFrancis3-Nov-03 8:42 
Generalthanks! Trying it out now...... Pin
ns3-Nov-03 8:53
ns3-Nov-03 8:53 
GeneralRe: thanks! Trying it out now...... Pin
souldog3-Nov-03 9:42
souldog3-Nov-03 9:42 
GeneralRe: thanks! Trying it out now...... Pin
ns4-Nov-03 2:04
ns4-Nov-03 2:04 
GeneralStruggling with Regex Pin
DimkaSPB3-Nov-03 5:27
DimkaSPB3-Nov-03 5:27 
GeneralRe: Struggling with Regex Pin
Michael Dunn3-Nov-03 5:33
sitebuilderMichael Dunn3-Nov-03 5:33 
GeneralRe: Struggling with Regex Pin
DimkaSPB3-Nov-03 7:32
DimkaSPB3-Nov-03 7:32 
GeneralRe: Struggling with Regex Pin
Michael Dunn3-Nov-03 7:41
sitebuilderMichael Dunn3-Nov-03 7:41 
Generaldumb question Pin
K. Shaffer3-Nov-03 5:19
K. Shaffer3-Nov-03 5:19 
GeneralRe: dumb question Pin
David Crow3-Nov-03 5:23
David Crow3-Nov-03 5:23 
GeneralRe: dumb question Pin
Michael Dunn3-Nov-03 5:27
sitebuilderMichael Dunn3-Nov-03 5:27 
GeneralRe: dumb question Pin
K. Shaffer3-Nov-03 5:37
K. Shaffer3-Nov-03 5:37 
GeneralRe: dumb question Pin
Maxwell Chen3-Nov-03 16:47
Maxwell Chen3-Nov-03 16:47 
GeneralRe: dumb question Pin
Alton Williams5-Nov-03 0:26
Alton Williams5-Nov-03 0:26 
GeneralMDI application &amp; DLLs Pin
mfcbeginer3-Nov-03 5:06
mfcbeginer3-Nov-03 5:06 
GeneralSerialization questions Pin
Alton Williams3-Nov-03 4:35
Alton Williams3-Nov-03 4:35 
GeneralRe: Serialization questions Pin
Steve S3-Nov-03 22:59
Steve S3-Nov-03 22:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.