Click here to Skip to main content
15,922,533 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Help wanted with CRecordset Pin
David Crow21-Jan-05 10:15
David Crow21-Jan-05 10:15 
GeneralGetKeyState Pin
vidhyas20-Jan-05 17:06
vidhyas20-Jan-05 17:06 
GeneralRe: GetKeyState Pin
Blake Miller21-Jan-05 8:53
Blake Miller21-Jan-05 8:53 
Generalabout WM_DEVCHANGE notification Pin
gly20-Jan-05 15:57
gly20-Jan-05 15:57 
GeneralWSAAsyncSelect CANNOT post socket event notifications, Plz help... Pin
enoloo_don20-Jan-05 14:48
enoloo_don20-Jan-05 14:48 
QuestionADO with RecordBinding Question ? Pin
Anonymous20-Jan-05 14:43
Anonymous20-Jan-05 14:43 
QuestionHow to detect the activity of specified devices? Pin
ErisonWu20-Jan-05 14:02
ErisonWu20-Jan-05 14:02 
GeneralThe hell of LBN_ERRSPACE Pin
Alfonso Vila20-Jan-05 13:52
Alfonso Vila20-Jan-05 13:52 
I've been creating a simple Win32 (not MFC) program, with a List Box Control (with images and a Image List), but when I try to read the selection get 0, or when I should receive a LBS_SELCHANGE notify message, I receive a WM_NOTIFY->LBN_ERRSPACE error:

"An application sends the LBN_ERRSPACE notification message when a list box cannot allocate enough memory to meet a specific request. The parent window of the list box receives this notification message through the WM_COMMAND message."

This solves nothing at all. The RC:
CONTROL "List1",IDC_LAPP,"SysListView32",LVS_LIST |
LVS_SINGLESEL | LBS_STANDARD | WS_TABSTOP,63,7,158,204,
WS_EX_CLIENTEDGE

The code:

Item = GetDlgItem(hWnd, IDC_LAPP);<br />
...<br />
ImageList = ImageList_Create(IconSize, IconSize, ILC_COLORDDB, 0, 0);<br />
...<br />
SendMessage(Item, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ImageList);<br />
...<br />
memset(&LVI, 0, sizeof(LVITEM));<br />
LVI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_NORECOMPUTE | LVIF_DI_SETITEM;<br />
LVI.iItem = 0;<br />
LVI.iSubItem = 0;<br />
LVI.pszText = Disco.Base->Name;<br />
LVI.cchTextMax = sizeof(Disco.Base->Name);<br />
LVI.iImage = 0;<br />
LVI.lParam = NULL;<br />
LVI.iIndent = 0;<br />
LVI.stateMask = LVIS_SELECTED;<br />
SendMessage(Item, LVM_INSERTITEM, 0, (LPARAM)&LVI);<br />
<br />
LVI.pszText = "Mazonza2";<br />
LVI.iImage = 1;<br />
SendMessage(Item, LVM_INSERTITEM, 0, (LPARAM)&LVI);<br />
<br />
case WM_NOTIFY:<br />
	if(wParam == IDC_LAPP)<br />
	{<br />
		pnmh = (LPNMHDR) lParam;<br />
		if((pnmh->code == LBN_ERRSPACE) || (pnmh->code == LBN_SELCHANGE))<br />
		{<br />
			Sel = SendMessage(Item, LB_GETCURSEL, 0, 0);<br />
			if(Sel != LB_ERR)<br />
			{<br />
				sprintf(S, "%i - %s", Sel, (pnmh->code==LBN_ERRSPACE ? "LBN_ERRSPACE" : "LBN_SELCHANGE"));<br />
				MessageBox(NULL, S, "WM_NOTIFY", MB_OK);<br />
				}<br />
			}<br />
		}<br />
	break;<br />
<br />
<br />


What am I doing wrong? D'Oh! | :doh: Memory from where? No memory problems on the system at all, everything is controllated, so may be the code.

Thanks.

Alfonso Vila

"If the program works at first, maybe you're in an exam"
GeneralRe: The hell of LBN_ERRSPACE Pin
Shog920-Jan-05 14:34
sitebuilderShog920-Jan-05 14:34 
Generalsystem tray right-click menu Pin
Anonymous20-Jan-05 13:42
Anonymous20-Jan-05 13:42 
GeneralRe: system tray right-click menu Pin
nm_11420-Jan-05 18:01
nm_11420-Jan-05 18:01 
GeneralRe: system tray right-click menu Pin
lillah21-Jan-05 0:03
lillah21-Jan-05 0:03 
GeneralRe: system tray right-click menu Pin
Anonymous21-Jan-05 13:16
Anonymous21-Jan-05 13:16 
GeneralDevelop FTA Tool Help Pin
XiaoYu20-Jan-05 13:41
XiaoYu20-Jan-05 13:41 
Questionhow to get the usb device's disk name,like &quot;H:&quot;? Pin
lowiq20-Jan-05 13:41
lowiq20-Jan-05 13:41 
GeneralCatching Keyboard events Pin
FayezElFar20-Jan-05 11:47
FayezElFar20-Jan-05 11:47 
GeneralRe: Catching Keyboard events Pin
Blake Miller21-Jan-05 8:59
Blake Miller21-Jan-05 8:59 
GeneralNo Updates When Loss Focus Pin
Grahamfff20-Jan-05 10:26
Grahamfff20-Jan-05 10:26 
GeneralRe: No Updates When Loss Focus Pin
Mircea Puiu21-Jan-05 0:24
Mircea Puiu21-Jan-05 0:24 
GeneralRe: No Updates When Loss Focus Pin
Grahamfff22-Jan-05 10:10
Grahamfff22-Jan-05 10:10 
QuestionCall OnClose or PostNcDestroy? Pin
Anonymous20-Jan-05 10:03
Anonymous20-Jan-05 10:03 
AnswerRe: Call OnClose or PostNcDestroy? Pin
Blake Miller20-Jan-05 11:12
Blake Miller20-Jan-05 11:12 
AnswerRe: Call OnClose or PostNcDestroy? Pin
Shog920-Jan-05 13:22
sitebuilderShog920-Jan-05 13:22 
AnswerRe: Call OnClose or PostNcDestroy? Pin
David Crow21-Jan-05 10:19
David Crow21-Jan-05 10:19 
GeneralCButton Pin
poiut20-Jan-05 9:59
poiut20-Jan-05 9:59 

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.