How to get the CEdit box to update
-
I am making a autoupdater, using a CEdit text box to show a logg during the update progress, however only static_text and the progress bar updates as the tool runs the performed action, but only updates when the action is complete. this code is called on each update stage, progress bar in the code bellow updates as it should, but not the SetWindowText, untill the "update button" function is complete. void CAutoUpdaterDlg::OnBnClickedUpdate() { CEdit * s = static_cast(GetDlgItem(IDC_STATIC_MSG)); s->SetWindowText("Please wait, update in progress."); CButton *b = static_cast(GetDlgItem(IDC_UPDATE)); CButton *b2 = static_cast(GetDlgItem(IDCANCEL)); b2->EnableWindow(false); b->EnableWindow(false); sprintf(DynamicBuffer,"%s","Looking for updates...\n");OnUpdateScreen(); GetList(); // Downloads, test the list for readability // Read the file into memory file_LoadIntoMem("UpdateList.txt"); // Download the files read from the UpdateList sprintf(DynamicBuffer,"%s","Downloading new content in progress...\n"); OnUpdateScreen();GetTheFiles(); // After reading it into memory, delete it. CleanUp(); // Finaly enable the buttons again b->EnableWindow(true); b2->EnableWindow(true); s->SetWindowText(""); } void CAutoUpdaterDlg::OnUpdateScreen() { char LocalBuffer[10]; itter++; lineslimit++; sprintf(LocalBuffer, "%d", itter); CEdit * p = static_cast(GetDlgItem(IDC_Window)); // static message for now strcat(WindowBuffer, LocalBuffer); strcat(WindowBuffer, ": "); strcat(WindowBuffer, DynamicBuffer); int Size = strlen(WindowBuffer); p->SetMargins(5,5); p->SetWindowText(Convert_A_To_DA(WindowBuffer)); CProgressCtrl * progress = static_cast(GetDlgItem(IDC_PROGRESS)); progress->SetRange(0,MaxRange);Progress++; progress->SetPos(Progress); if (lineslimit == 11) { int size = strlen(WindowBuffer); for(int i = 0; i <= size+1; i++ ) { WindowBuffer[i] = 0x00; } lineslimit = 0; } int MemSize = sizeof(DynamicBuffer); for(int i = 0; i<= MemSize+1; i++) { DynamicBuffer[i] = 0x00; } }
-
I am making a autoupdater, using a CEdit text box to show a logg during the update progress, however only static_text and the progress bar updates as the tool runs the performed action, but only updates when the action is complete. this code is called on each update stage, progress bar in the code bellow updates as it should, but not the SetWindowText, untill the "update button" function is complete. void CAutoUpdaterDlg::OnBnClickedUpdate() { CEdit * s = static_cast(GetDlgItem(IDC_STATIC_MSG)); s->SetWindowText("Please wait, update in progress."); CButton *b = static_cast(GetDlgItem(IDC_UPDATE)); CButton *b2 = static_cast(GetDlgItem(IDCANCEL)); b2->EnableWindow(false); b->EnableWindow(false); sprintf(DynamicBuffer,"%s","Looking for updates...\n");OnUpdateScreen(); GetList(); // Downloads, test the list for readability // Read the file into memory file_LoadIntoMem("UpdateList.txt"); // Download the files read from the UpdateList sprintf(DynamicBuffer,"%s","Downloading new content in progress...\n"); OnUpdateScreen();GetTheFiles(); // After reading it into memory, delete it. CleanUp(); // Finaly enable the buttons again b->EnableWindow(true); b2->EnableWindow(true); s->SetWindowText(""); } void CAutoUpdaterDlg::OnUpdateScreen() { char LocalBuffer[10]; itter++; lineslimit++; sprintf(LocalBuffer, "%d", itter); CEdit * p = static_cast(GetDlgItem(IDC_Window)); // static message for now strcat(WindowBuffer, LocalBuffer); strcat(WindowBuffer, ": "); strcat(WindowBuffer, DynamicBuffer); int Size = strlen(WindowBuffer); p->SetMargins(5,5); p->SetWindowText(Convert_A_To_DA(WindowBuffer)); CProgressCtrl * progress = static_cast(GetDlgItem(IDC_PROGRESS)); progress->SetRange(0,MaxRange);Progress++; progress->SetPos(Progress); if (lineslimit == 11) { int size = strlen(WindowBuffer); for(int i = 0; i <= size+1; i++ ) { WindowBuffer[i] = 0x00; } lineslimit = 0; } int MemSize = sizeof(DynamicBuffer); for(int i = 0; i<= MemSize+1; i++) { DynamicBuffer[i] = 0x00; } }
Try using the UpdateData(...) function for the dialog before you referesh it's window or ask it to display something. If you call UpdateData(FALSE) it should write whatever you have in the SetWindowText(...) or value variable for that control onto the screen.
-
Try using the UpdateData(...) function for the dialog before you referesh it's window or ask it to display something. If you call UpdateData(FALSE) it should write whatever you have in the SetWindowText(...) or value variable for that control onto the screen.
UpdateWindow(); this function worked perfect, thanks.