Click here to Skip to main content
15,922,325 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralDirectX stipple lines Pin
mikeh3-Nov-03 7:52
mikeh3-Nov-03 7:52 
GeneralRe: DirectX stipple lines Pin
Jeryth3-Nov-03 10:25
Jeryth3-Nov-03 10:25 
GeneralRe: DirectX stipple lines Pin
mikeh3-Nov-03 10:54
mikeh3-Nov-03 10:54 
GeneralRe: DirectX stipple lines Pin
Jeryth3-Nov-03 11:54
Jeryth3-Nov-03 11:54 
GeneralRe: DirectX stipple lines Pin
Jeryth3-Nov-03 14:32
Jeryth3-Nov-03 14:32 
GeneralRe: DirectX stipple lines Pin
ZoogieZork3-Nov-03 18:18
ZoogieZork3-Nov-03 18:18 
GeneralRe: DirectX stipple lines Pin
mikeh4-Nov-03 3:05
mikeh4-Nov-03 3:05 
GeneralRe: DirectX stipple lines Pin
mikeh6-Nov-03 2:18
mikeh6-Nov-03 2:18 
GeneralGetFolderFromID() from Namespace Pin
chz171065xy3-Nov-03 7:27
chz171065xy3-Nov-03 7:27 
Generalgetline question Pin
Anonymous3-Nov-03 7:27
Anonymous3-Nov-03 7:27 
GeneralRe: getline question Pin
Alton Williams3-Nov-03 7:56
Alton Williams3-Nov-03 7:56 
GeneralRe: getline question Pin
Anonymous3-Nov-03 9:58
Anonymous3-Nov-03 9:58 
GeneralRe: getline question Pin
Joaquín M López Muñoz3-Nov-03 10:04
Joaquín M López Muñoz3-Nov-03 10:04 
GeneralRe: getline question Pin
Jeryth3-Nov-03 10:13
Jeryth3-Nov-03 10:13 
GeneralPorting from WinCE to VC++ Pin
VanHlebar3-Nov-03 7:18
VanHlebar3-Nov-03 7:18 
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 

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.