Click here to Skip to main content
15,907,225 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Urgent: changing proxy settings programmatically Pin
Vaibhav Sanghavi21-Jun-04 21:23
Vaibhav Sanghavi21-Jun-04 21:23 
GeneralRe: Urgent: changing proxy settings programmatically Pin
Johan Rosengren21-Jun-04 23:18
Johan Rosengren21-Jun-04 23:18 
GeneralRe: Urgent: changing proxy settings programmatically Pin
Antony M Kancidrowski22-Jun-04 0:29
Antony M Kancidrowski22-Jun-04 0:29 
GeneralRe: Urgent: changing proxy settings programmatically Pin
Johan Rosengren22-Jun-04 0:38
Johan Rosengren22-Jun-04 0:38 
GeneralRe: Urgent: changing proxy settings programmatically Pin
Antony M Kancidrowski22-Jun-04 3:58
Antony M Kancidrowski22-Jun-04 3:58 
GeneralRe: Urgent: changing proxy settings programmatically Pin
Vaibhav Sanghavi22-Jun-04 19:16
Vaibhav Sanghavi22-Jun-04 19:16 
GeneralRe: Urgent: changing proxy settings programmatically Pin
Johan Rosengren22-Jun-04 20:15
Johan Rosengren22-Jun-04 20:15 
GeneralREPOST: Weird SetItemText behavior in multiple CListCtrls Pin
otrcomm21-Jun-04 19:16
otrcomm21-Jun-04 19:16 
Hello,

Sorry for the repost, but I didn't see the checkbox for ignoring <'s.

I am new to this forum, so howdy!

I am using Visual C++ 6.

I have a weird problem with SetItemText when trying to use multiple CListCtrls.

I have mail that I am reading from a POP3 server and trying to put it in separate CListCtrls based on certain mail header entries.

Here is a snippet of code that is causing the problems:

<snip>
for (msg_num=1;msg_num<=num_msgs;msg_num++)
{

cmsg_num.Format(_T("%d"), msg_num);

POP_messages[msg_num].pop_num = msg_num;
POP_messages[msg_num].msg_num = msg_num;

if (m_pop3handle.GetMailSubject(msg_num, &msg))
{
if (strcmp(classified,"Ham") == 0) {
POP_messages[msg_num].Subject = msg;
m_listHam.InsertItem(nItem,(LPCTSTR)msg);
} else {
POP_messages[msg_num].Subject = msg;
m_listSpam.InsertItem(nItem,(LPCTSTR)msg);
}
}
else
{
m_pop3handle.GetLastError(&msg);
m_edtMsg += msg+"\r\n";
}

if (m_pop3handle.GetMailSender(msg_num, &msg))
{
if (strcmp(classified,"Ham") == 0) {
POP_messages[msg_num].From = msg;
m_listHam.SetItemText(nItem,1,(LPCTSTR)msg);
} else {
POP_messages[msg_num].From = msg;
m_listSpam.SetItemText(nItem,1,(LPCTSTR)msg);

AfxMessageBox((LPCTSTR)msg);

}
}
else
{
m_pop3handle.GetLastError(&msg);
m_edtMsg += msg+"\r\n";
}

if (strcmp(classified,"Ham") == 0) {
m_listHam.SetItemText(nItem,2, (LPCTSTR)cmsg_num);
m_listHam.SetItemText(nItem,3, "");
} else {
m_listSpam.SetItemText(nItem,2, "");
m_listSpam.SetItemText(nItem,3, "");
}
nItem++;

} // End for (msg_num=1;msg_num<=num_msgs;msg_num++)

<snip>

Now the problem is, that all the InsertItem calls get set properly, but only the SetItemText values for the first row get set. That is, none of the other rows get values set in the second and third columns.

The MessageBox show valid data coming through the msg variable, but SetItemText is not successful (i.e,returns 0).

Anybody ever seen a problem like this?

Now, if I let everything come into a single CListCtrl, then all the SetItemText calls return successfully and values are placed in the
second and third columns.

Another weirdness is that is I double up on the InsertItem statements, i.e.,

<snip>

if (strcmp(classified,"Ham") == 0) {
POP_messages[msg_num].Subject = msg;
m_listHam.InsertItem(nItem,(LPCTSTR)msg);
m_listHam.InsertItem(nItem,(LPCTSTR)msg);
} else {
POP_messages[msg_num].Subject = msg;
m_listSpam.InsertItem(nItem,(LPCTSTR)msg);
m_listSpam.InsertItem(nItem,(LPCTSTR)msg);
}

<snip>

then I get a row as before, with data in just the first column, followed by a row with data in all three columns, where the first column entry is the same as the previous row.

That is, I get something like the following:

<subject>
<subject> <email address> <msg num>

<subject>, <email address>, and <msg num> actually have values.


Any help would be greatly appreciated. Please reply via email also.

Thanks,
Murrah
otrcomm@isp-systems.com
GeneralRe: REPOST: Weird SetItemText behavior in multiple CListCtrls Pin
David Crow22-Jun-04 3:41
David Crow22-Jun-04 3:41 
GeneralRe: REPOST: Weird SetItemText behavior in multiple CListCtrls Pin
otrcomm22-Jun-04 7:04
otrcomm22-Jun-04 7:04 
GeneralWeird SetItemText behavior in multiple CListCtrls Pin
otrcomm21-Jun-04 19:12
otrcomm21-Jun-04 19:12 
QuestionHow can is Send and Recieve Messages from MSN Messenger Pin
Muhammad Irfan Azam21-Jun-04 19:01
Muhammad Irfan Azam21-Jun-04 19:01 
AnswerRe: How can is Send and Recieve Messages from MSN Messenger Pin
jmkhael21-Jun-04 22:19
jmkhael21-Jun-04 22:19 
GeneralTrying to start a new project, need help Pin
M.C.21-Jun-04 17:20
M.C.21-Jun-04 17:20 
GeneralRe: Trying to start a new project, need help Pin
palbano21-Jun-04 17:48
palbano21-Jun-04 17:48 
GeneralRe: Trying to start a new project, need help Pin
M.C.21-Jun-04 18:29
M.C.21-Jun-04 18:29 
GeneralRe: Trying to start a new project, need help Pin
Christian Graus21-Jun-04 18:17
protectorChristian Graus21-Jun-04 18:17 
GeneralRe: Trying to start a new project, need help Pin
M.C.21-Jun-04 18:34
M.C.21-Jun-04 18:34 
GeneralRe: Trying to start a new project, need help Pin
Christian Graus21-Jun-04 18:36
protectorChristian Graus21-Jun-04 18:36 
GeneralRe: Trying to start a new project, need help Pin
M.C.21-Jun-04 18:52
M.C.21-Jun-04 18:52 
QuestionHow to make and install an application that run as a 'process' Pin
Wayut21-Jun-04 16:22
Wayut21-Jun-04 16:22 
AnswerRe: How to make and install an application that run as a 'process' Pin
palbano21-Jun-04 16:45
palbano21-Jun-04 16:45 
GeneralRe: How to make and install an application that run as a 'process' Pin
Wayut21-Jun-04 18:21
Wayut21-Jun-04 18:21 
AnswerRe: How to make and install an application that run as a 'process' Pin
Shog921-Jun-04 18:08
sitebuilderShog921-Jun-04 18:08 
AnswerRe: How to make and install an application that run as a 'process' Pin
gamitech22-Jun-04 13:20
gamitech22-Jun-04 13:20 

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.