Click here to Skip to main content
15,925,371 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Problem in CMenu? Pin
Tomasz Sowinski30-Oct-01 0:39
Tomasz Sowinski30-Oct-01 0:39 
GeneralCOM - Linkage Problem with HWND Pin
Bernhard29-Oct-01 23:56
Bernhard29-Oct-01 23:56 
GeneralRe: COM - Linkage Problem with HWND Pin
Christian Graus30-Oct-01 1:53
protectorChristian Graus30-Oct-01 1:53 
GeneralRe: COM - Linkage Problem with HWND Pin
msears22-Jan-11 19:28
msears22-Jan-11 19:28 
GeneralTooltips Pin
29-Oct-01 22:24
suss29-Oct-01 22:24 
GeneralRe: Tooltips Pin
Roger Allen30-Oct-01 4:46
Roger Allen30-Oct-01 4:46 
Generalfor Tomasz Sowinski - how can i fill a CComboBox faster Pin
29-Oct-01 22:12
suss29-Oct-01 22:12 
GeneralRe: for Tomasz Sowinski - how can i fill a CComboBox faster Pin
Tomasz Sowinski30-Oct-01 0:07
Tomasz Sowinski30-Oct-01 0:07 
Basically, you want to avoid copying text during combobox load. Each item is marked as 'callback' - whenever combo actually needs the text (when it needs to repaint or show the dropdown list), it will ask your app. The loading is simple - you just pass LPSTR_TEXTCALLBACK as item text.

COMBOBOXEXITEM cbitem;
cbitem.mask = CBEIF_TEXT;
// ... init imax to number of records read
imax = ...;
for (int i = 0; i < imax; i ++)
{	
	cbitem.iItem = i;
	cbitem.pszText = LPSTR_TEXTCALLBACK;
	m_cbx.InsertItem(&cbitem);
}


Then, you should handle CBEN_GETDISPINFO notification in the parent window (probably this will be a dialog, property page or formview). Use ClassWizard to add the appropriate handler.

void CYourDialog::OnGetdispinfoNodeType(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NMCOMBOBOXEX *pNMCBX= (NMCOMBOBOXEX *)pNMHDR;
	// your data from DB is cached in some data structure
	// pNMCBX->ceItem.iItem contains an item number
	// you should use iItem to find the string and
	// store its address in pNMCBX->ceItem.pszText
	pNMCBX->ceItem.pszText = someTable[pNMCBX->ceItem.iItem];
	*pResult = 0;
}


Tomasz Sowinski -- http://www.shooltz.com
GeneralInstalled application on computer Pin
Fred/M29-Oct-01 22:02
Fred/M29-Oct-01 22:02 
GeneralRe: Installed application on computer Pin
Nish Nishant29-Oct-01 22:24
sitebuilderNish Nishant29-Oct-01 22:24 
GeneralRe: Installed application on computer Pin
Deepak Khajuria29-Oct-01 22:24
Deepak Khajuria29-Oct-01 22:24 
GeneralRe: Installed application on computer Pin
Fred/M30-Oct-01 0:41
Fred/M30-Oct-01 0:41 
GeneralRe: Installed application on computer Pin
Tomasz Sowinski30-Oct-01 1:09
Tomasz Sowinski30-Oct-01 1:09 
GeneralRe: Installed application on computer Pin
Fred/M30-Oct-01 3:14
Fred/M30-Oct-01 3:14 
Questionthe attachment of email? Pin
cococut29-Oct-01 20:35
cococut29-Oct-01 20:35 
AnswerRe: the attachment of email? Pin
Roger Allen30-Oct-01 4:42
Roger Allen30-Oct-01 4:42 
AnswerRe: the attachment of email? Pin
Anders Molin30-Oct-01 5:32
professionalAnders Molin30-Oct-01 5:32 
GeneralRe: the attachment of email? Pin
cococut30-Oct-01 14:48
cococut30-Oct-01 14:48 
QuestionUse CListView or MSFlexgrid ??? Pin
youssef29-Oct-01 19:51
youssef29-Oct-01 19:51 
AnswerRe: Use CListView or MSFlexgrid ??? Pin
Chris Maunder29-Oct-01 20:25
cofounderChris Maunder29-Oct-01 20:25 
GeneralMakefiles Pin
^GeeK^29-Oct-01 19:51
^GeeK^29-Oct-01 19:51 
Generalabout Font Pin
Maer72729-Oct-01 19:46
Maer72729-Oct-01 19:46 
GeneralRe: about Font Pin
Christian Graus29-Oct-01 23:24
protectorChristian Graus29-Oct-01 23:24 
GeneralRe: about Font Pin
Maer72729-Oct-01 23:47
Maer72729-Oct-01 23:47 
GeneralRe: about Font Pin
Jonathan de Halleux30-Oct-01 0:32
Jonathan de Halleux30-Oct-01 0:32 

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.