Mercurial > dwindows
comparison win/dw.c @ 351:84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 16 Apr 2003 12:00:00 +0000 |
parents | 2216e65ad2ae |
children | 3a71623fc219 |
comparison
equal
deleted
inserted
replaced
350:2216e65ad2ae | 351:84a24d739d12 |
---|---|
5172 * buffer: Buffer where text will be copied. | 5172 * buffer: Buffer where text will be copied. |
5173 * length: Length of the buffer (including NULL). | 5173 * length: Length of the buffer (including NULL). |
5174 */ | 5174 */ |
5175 void API dw_listbox_query_text(HWND handle, unsigned int index, char *buffer, unsigned int length) | 5175 void API dw_listbox_query_text(HWND handle, unsigned int index, char *buffer, unsigned int length) |
5176 { | 5176 { |
5177 SendMessage(handle, | 5177 char tmpbuf[100]; |
5178 LB_GETTEXT, (WPARAM)index, (LPARAM)buffer); | 5178 int len; |
5179 | |
5180 if(!buffer || !length) | |
5181 return; | |
5182 | |
5183 buffer[0] = 0; | |
5184 | |
5185 GetClassName(handle, tmpbuf, 99); | |
5186 | |
5187 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME))==0) | |
5188 { | |
5189 len = (int)SendMessage(handle, CB_GETLBTEXTLEN, (WPARAM)index, 0); | |
5190 | |
5191 if(len < length && len != CB_ERR) | |
5192 SendMessage(handle, | |
5193 CB_GETLBTEXT, (WPARAM)index, (LPARAM)buffer); | |
5194 } | |
5195 else | |
5196 { | |
5197 len = (int)SendMessage(handle, LB_GETTEXTLEN, (WPARAM)index, 0); | |
5198 | |
5199 if(len < length && len != LB_ERR) | |
5200 SendMessage(handle, | |
5201 LB_GETTEXT, (WPARAM)index, (LPARAM)buffer); | |
5202 } | |
5179 } | 5203 } |
5180 | 5204 |
5181 /* | 5205 /* |
5182 * Returns the index to the item in the list currently selected. | 5206 * Returns the index to the item in the list currently selected. |
5183 * Parameters: | 5207 * Parameters: |