Click here to Skip to main content
15,920,632 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: AfxGetMainWnd() equals to AfxGetMainWnd ? Pin
Richard MacCutchan22-Jul-11 4:18
mveRichard MacCutchan22-Jul-11 4:18 
GeneralRe: AfxGetMainWnd() equals to AfxGetMainWnd ? Pin
«_Superman_»22-Jul-11 6:03
professional«_Superman_»22-Jul-11 6:03 
GeneralRe: AfxGetMainWnd() equals to AfxGetMainWnd ? Pin
Richard MacCutchan22-Jul-11 22:58
mveRichard MacCutchan22-Jul-11 22:58 
GeneralRe: AfxGetMainWnd() equals to AfxGetMainWnd ? Pin
«_Superman_»23-Jul-11 4:01
professional«_Superman_»23-Jul-11 4:01 
GeneralRe: AfxGetMainWnd() equals to AfxGetMainWnd ? Pin
Richard MacCutchan23-Jul-11 4:25
mveRichard MacCutchan23-Jul-11 4:25 
QuestionRe: AfxGetMainWnd() equals to AfxGetMainWnd ? Pin
David Crow22-Jul-11 6:03
David Crow22-Jul-11 6:03 
JokeRe: AfxGetMainWnd() equals to AfxGetMainWnd ? Pin
«_Superman_»22-Jul-11 9:28
professional«_Superman_»22-Jul-11 9:28 
GeneralRe: AfxGetMainWnd() equals to AfxGetMainWnd ? Pin
yu-jian25-Jul-11 4:20
yu-jian25-Jul-11 4:20 
QuestionQUERY: How to control external exe & read it's process details Pin
andwan021-Jul-11 5:16
andwan021-Jul-11 5:16 
AnswerRe: QUERY: How to control external exe & read it's process details Pin
Richard Andrew x6421-Jul-11 5:34
professionalRichard Andrew x6421-Jul-11 5:34 
AnswerRe: QUERY: How to control external exe & read it's process details Pin
Abhi Lahare21-Jul-11 5:38
Abhi Lahare21-Jul-11 5:38 
AnswerRe: QUERY: How to control external exe & read it's process details Pin
jschell21-Jul-11 8:50
jschell21-Jul-11 8:50 
AnswerRe: QUERY: How to control external exe & read it's process details Pin
«_Superman_»21-Jul-11 9:00
professional«_Superman_»21-Jul-11 9:00 
QuestionDoes "delete" operator work for PVOID pointers? Pin
Cold_Fearing_Bird21-Jul-11 2:36
Cold_Fearing_Bird21-Jul-11 2:36 
AnswerRe: Does "delete" operator work for PVOID pointers? Pin
Maximilien21-Jul-11 3:03
Maximilien21-Jul-11 3:03 
GeneralRe: Does "delete" operator work for PVOID pointers? Pin
Albert Holguin21-Jul-11 4:31
professionalAlbert Holguin21-Jul-11 4:31 
AnswerRe: Does "delete" operator work for PVOID pointers? Pin
Rajesh R Subramanian21-Jul-11 3:23
professionalRajesh R Subramanian21-Jul-11 3:23 
GeneralRe: Does "delete" operator work for PVOID pointers? Pin
Cold_Fearing_Bird21-Jul-11 4:37
Cold_Fearing_Bird21-Jul-11 4:37 
GeneralRe: Does "delete" operator work for PVOID pointers? Pin
Chris Losinger21-Jul-11 5:01
professionalChris Losinger21-Jul-11 5:01 
GeneralRe: Does "delete" operator work for PVOID pointers? Pin
David Crow21-Jul-11 5:11
David Crow21-Jul-11 5:11 
Cold_Fearing_Bird wrote:
Because the object is dynamically allocated, I cannot determine its exact type.

So the items in the listview "point to" different types of data? If that's the case, wrap the data and the type in a struct like:

struct data_and_type
{
    int type; // 0=CREATESTRUCT, 1=PAINTSTRUCT
    PVOID data;
};
  
data_and_type *dt = new data_and_type;
dt->type = 0;
dt->data = (CREATESTRUCT *) new CREATESTRUCT;
  
SetItemData(..., (DWORD) dt);
Now when you are ready to delete:

dt = (data_and_type *) GetItemData();
if (dt->type == 0)
{
    CREATESTRUCT *cs = (CREATESTRUCT *) dt->data;
    delete cs;
}
else if (dt->type == 1)
...
Clear as mud?

"One man's wage rise is another man's price increase." - Harold Wilson

"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather


GeneralRe: Does "delete" operator work for PVOID pointers? Pin
Richard Andrew x6421-Jul-11 5:31
professionalRichard Andrew x6421-Jul-11 5:31 
GeneralRe: Does "delete" operator work for PVOID pointers? Pin
David Crow21-Jul-11 6:16
David Crow21-Jul-11 6:16 
GeneralRe: Does "delete" operator work for PVOID pointers? Pin
Stefan_Lang22-Jul-11 0:35
Stefan_Lang22-Jul-11 0:35 
AnswerRe: Does "delete" operator work for PVOID pointers? Pin
Chris Losinger21-Jul-11 4:55
professionalChris Losinger21-Jul-11 4:55 
GeneralRe: Does "delete" operator work for PVOID pointers? Pin
Maximilien21-Jul-11 5:03
Maximilien21-Jul-11 5:03 

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.