I wonder if I'm appending text to an edit control the right way.
Code:
BOOL CALLBACK dialogProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
    HWND hwndText;
    static char buffer[1024];
    int i, iWindowTextLength;
    char* sCurrentText;
    
    ...
    hwndText = GetDlgItem(hwndDialog, 1);
    iWindowTextLength = GetWindowTextLength(hwndText);
  
    sCurrentText = (char*)malloc((iWindowTextLength+1)*sizeof(int));
    GetDlgItemText(hwndDialog, 1, sCurrentText, iWindowTextLength+1);

    sCurrentText = realloc(sCurrentText, (1024+iWindowTextLength+1)*sizeof(int));
    ...
    strcat(sCurrentText, buffer);
    SetDlgItemText(hwndDialog, 1, sCurrentText);
    free(sCurrentText);
    ...
}
First I get the current length of the text. In order to store this text I allocate a memory block of iWindowTextLength+1 bytes. Then I change the length of this memory block in order to make room to append some text. The buffer variable contains the text to append. I append buffer the end of sCurrentText. Finally I use SetDlgItemText to update the edito control content.

Is everything ok this way? Is there a better way to append text to the current edit control content?