Ciao a tutti,
ho creato un edit control con questa chiamata :
codice:
HWND hCtrl0_17 = CreateWindowEx(0, WC_EDIT, 0, WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_BORDER | ES_READONLY | WS_VSCROLL | ES_MULTILINE | ES_AUTOHSCROLL | ES_AUTOVSCROLL, 8, 221, 341, 81, hwnd, (HMENU)IDC_INFOBOX, GetModuleHandle(NULL), 0);
e scrivo stringhe di testo nel medesimo con questa funzione :
codice:
void InfoBoxPrint( char *ToBePrinted )
{
#define BOX_BUFFER_SIZE 1024
static char buffer[BOX_BUFFER_SIZE];
static int AllocatedMemory;
int i = 0;
while ( ToBePrinted[i++] != '\0' )
++AllocatedMemory;
if ( AllocatedMemory > BOX_BUFFER_SIZE )
{
AllocatedMemory = 0;
for(i = 0; i <= BOX_BUFFER_SIZE; i++)
buffer[i] = 0;
}
strncat(buffer, ToBePrinted, BOX_BUFFER_SIZE);
SetDlgItemText(hwndMain, IDC_INFOBOX, buffer);
}
Il mio problema e' di non riuscire ad auto-scrollare l' edit box, infatti quando arrivano ad esserci stringhe + lunghe del contenitore dell' editbox, quest' ultimo mi abilita le frecciette di scroll verticali ma non mi scrolla all' ultima riga, esempio :
codice:
------------------------------------------
|1a stringa |
|2a |
|3a |
------------------------------------------
4a
5a
Quindi per vedere l' ultima stringa scritta nel box devo scrollare manualmente verso il basso, cosa che vorrei fosse fatta in automatico.
Grazie.