CComboBox::GetLBTextLen

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

CComboBox::GetLBTextLen

CListBoxはGetTextLenだったが、CComboBoxはGetLBTextLenで長さを取得・・・。

f:id:BG1:20160405143433p:plain

追加ボタンButton1に加えて、選択された項目のテキストの長さを表示するButton2を用意・・・。

pComboBox1->GetCurSelでインデックスを取得・・・。
そのインデックスを使って、pComboBox1->GetLBTextLenで選択項目のテキストの長さを取得・・・。
_stprintfで長さを文字列に変換して、AfxMessageBoxで表示・・・。

f:id:BG1:20160405144115p:plain

"あいうえお"でButton2を押す・・・。

f:id:BG1:20160405144209p:plain

長さ5・・・。

f:id:BG1:20160405144243p:plain

"123"でButton2を押す・・・。

f:id:BG1:20160405144337p:plain

長さ3・・・。

f:id:BG1:20160405144405p:plain

"ABC"でButton2を押す・・・。

f:id:BG1:20160405144452p:plain

長さ3・・・。

Sample/CComboBox.h at master · bg1bgst333/Sample · GitHub
Sample/CComboBox.cpp at master · bg1bgst333/Sample · GitHub
Sample/CComboBoxDlg.h at master · bg1bgst333/Sample · GitHub
Sample/CComboBoxDlg.cpp at master · bg1bgst333/Sample · GitHub
Sample/resource.h at master · bg1bgst333/Sample · GitHub
Sample/CComboBox.rc at master · bg1bgst333/Sample · GitHub
Sample/stdafx.h at master · bg1bgst333/Sample · GitHub
Sample/stdafx.cpp at master · bg1bgst333/Sample · GitHub