Click here to Skip to main content
15,900,108 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Password Program Help Please!!! Pin
David Crow26-Aug-09 10:58
David Crow26-Aug-09 10:58 
GeneralRe: Password Program Help Please!!! Pin
posidonofthecode27-Aug-09 14:29
posidonofthecode27-Aug-09 14:29 
QuestionFunction return? Pin
dipuks26-Aug-09 7:39
dipuks26-Aug-09 7:39 
AnswerRe: Function return? Pin
Code-o-mat26-Aug-09 9:14
Code-o-mat26-Aug-09 9:14 
Question/embedding setting does not work on Vista Pin
Fwzklmn26-Aug-09 7:35
Fwzklmn26-Aug-09 7:35 
QuestionHow do some viruses act without appearing in task manager? Pin
Joseph Marzbani26-Aug-09 7:00
Joseph Marzbani26-Aug-09 7:00 
AnswerRe: How do some viruses act without appearing in task manager? Pin
zhu_lin26-Aug-09 22:31
zhu_lin26-Aug-09 22:31 
QuestionSetting the item count for a CListBox 'No Data' control Pin
tmcart26-Aug-09 5:38
tmcart26-Aug-09 5:38 
Hi All,

My target platform is Windows Mobile 6.5.

I've created a 'virtual' CListBox with the styles LBS_NODATA, LBS_OWNERDRAWFIXED set and styles LBS_SORT, LBS_HASSTRINGS unset. I have a vector of 'owner data' and have implemented the DrawItem() function for the owner draw side.

My problem comes when trying to set the count of items that are in the 'virtual' CListBox.

SendMessage() for LB_SETCOUNT does not return an error yet neither does it actually modify the CListBox's count. I am able to force the count to increase via iterating AddString(NULL) for the number of items in the list, but that breaks the whole concept of a 'virtual' list.

I'm after the equivalent of CListCtrl's SetItemCountEx().

#define LB_SETCOUNT  0x1A7

BOOL CTestDialog::OnInitDialog()
{
    CDialog::OnInitDialog();
    m_data.reserve(5000);

    for (int i=0;i < 5000; ++i)
    {
        CString fmt;
        fmt.Format(L"Item %04d",i);
        m_data.push_back(fmt);

        /* This will force m_listbox.GetCount() to the correct number but results in the huge lag which I
         * am trying to avoid by being 'no data' and 'owner draw'.
         *
         * m_listbox.AddString(NULL);
         */
    }

    LRESULT result;
    result = m_listbox.SendMessage(LB_SETCOUNT,
                                  (WPARAM)(int)5000, 
                                  (LPARAM)0);

    int cnt = m_listbox.GetCount();

    m_listbox.SetItemHeight(0, 25);

    m_listbox.Invalidate();

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}

AnswerRe: Setting the item count for a CListBox 'No Data' control Pin
David Crow26-Aug-09 6:10
David Crow26-Aug-09 6:10 
QuestionRe: Setting the item count for a CListBox 'No Data' control [modified] Pin
tmcart26-Aug-09 6:47
tmcart26-Aug-09 6:47 
AnswerRe: Setting the item count for a CListBox 'No Data' control Pin
tmcart3-Sep-09 23:39
tmcart3-Sep-09 23:39 
QuestionLimit Number of connections from a given IP Pin
Veandhan26-Aug-09 5:26
Veandhan26-Aug-09 5:26 
QuestionRe: Limiting Connections from a given IP in MFC Pin
CPallini26-Aug-09 5:47
mveCPallini26-Aug-09 5:47 
AnswerRe: Limiting Connections from a given IP in MFC Pin
Rajesh R Subramanian26-Aug-09 7:48
professionalRajesh R Subramanian26-Aug-09 7:48 
AnswerRe: Limiting Connections from a given IP in MFC Pin
David Crow26-Aug-09 9:22
David Crow26-Aug-09 9:22 
GeneralRe: Limiting Connections from a given IP in MFC Pin
Rajesh R Subramanian26-Aug-09 18:49
professionalRajesh R Subramanian26-Aug-09 18:49 
GeneralRe: Limiting Connections from a given IP in MFC Pin
CPallini26-Aug-09 21:36
mveCPallini26-Aug-09 21:36 
JokeRe: Limiting Connections from a given IP in MFC Pin
Rajesh R Subramanian26-Aug-09 22:22
professionalRajesh R Subramanian26-Aug-09 22:22 
JokeRe: Limiting Connections from a given IP in MFC Pin
CPallini26-Aug-09 22:37
mveCPallini26-Aug-09 22:37 
GeneralRe: Limiting Connections from a given IP in MFC Pin
Rajesh R Subramanian26-Aug-09 23:09
professionalRajesh R Subramanian26-Aug-09 23:09 
QuestionRe: Limiting Connections from a given IP in MFC Pin
David Crow26-Aug-09 6:03
David Crow26-Aug-09 6:03 
AnswerRe: Limit Number of connections from a given IP Pin
Rajesh R Subramanian26-Aug-09 7:41
professionalRajesh R Subramanian26-Aug-09 7:41 
QuestionRe: Limit Number of connections from a given IP Pin
Veandhan26-Aug-09 15:54
Veandhan26-Aug-09 15:54 
AnswerRe: Limit Number of connections from a given IP Pin
Rajesh R Subramanian26-Aug-09 16:51
professionalRajesh R Subramanian26-Aug-09 16:51 
GeneralRe: Limit Number of connections from a given IP Pin
Veandhan26-Aug-09 16:57
Veandhan26-Aug-09 16:57 

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.