CListBox::GetTextLen

CListBox::GetTextLenは、リストボックスの選択されている項目のテキストの長さを取得するメンバ関数・・・。

CListBox::GetTextLen

選択されている項目のテキストを取得したいが、その前にどれくらいの長さかわからないとバッファを作れないのでこれで長さを取得する・・・。

f:id:BG1:20160331112508p:plain

このように配置して、

pListBox1->GetCurSelで取得したインデックスidxをpListBox1->GetTextLenに渡して、取得した長さをlenに格納し、lenを文字列に変換してメッセージボックスで表示・・・。

f:id:BG1:20160331112742p:plain

"あいうえお"の長さは、

f:id:BG1:20160331112810p:plain

5・・・。

f:id:BG1:20160331112827p:plain

"123"の長さは、

f:id:BG1:20160331112859p:plain

3・・・。

f:id:BG1:20160331112931p:plain

"ABC"の長さは、

f:id:BG1:20160331112951p:plain

3・・・。

Sample/CListBox.h at master · bg1bgst333/Sample · GitHub
Sample/CListBox.cpp at master · bg1bgst333/Sample · GitHub
Sample/CListBoxDlg.h at master · bg1bgst333/Sample · GitHub
Sample/CListBoxDlg.cpp at master · bg1bgst333/Sample · GitHub
Sample/resource.h at master · bg1bgst333/Sample · GitHub
Sample/CListBox.rc at master · bg1bgst333/Sample · GitHub
Sample/stdafx.h at master · bg1bgst333/Sample · GitHub
Sample/stdafx.cpp at master · bg1bgst333/Sample · GitHub