Hi All,
Pelles c 7.00.355 Win64 on Win7 OS
Project created as Win 64 Dialog
The purpose of my code is to loop count upwards and
update an edit box in a dialog GUI, every 1 sec.
Basically I know that the background thread runs
and counts up because I can use a Dialog Button
to read-to-screen the contents of the global variable.
But I am NOT able to get the background function
to direclty update the Edit Box.
Back when I used MS Vis Stud 6.0 I did this hundreds
of times - you have to use AfxBEginThread().
In Vis Stud 6, MFC it is required that after you
write the data to the Edit Box that you call
UpdateData(FALSE),
but that function gives a error when compiling
as undeclared.
Any help is MUCh appreciated !
======= BEGIN My background function ========
void th01(void* pParam)
{
int jj;
for (jj = 0; jj < 100; jj++)
{
//assign jj value to global variable (integer) gx01
gx01 = jj;
//convert int to str and set global buffer (char) gbuf1
sprintf(gbuf1, "%d", gx01);
//write gbuf1 contents to GUI Edit Box (id = 4003)
SetDlgItemText(ghwndDlg, 4003, _T(gbuf1));
//sleep for millisecs
Sleep(1000);
} // end for (jj = 0; jj < 100; jj++)
} // end func void th01(void* pParam)
======= END My background function ========
======= BEGIN code that starts the thread =======
Within the function: MainDlgProc(),
In the section of "case": WM_INITDIALOG,
my code is:
int n = 123;
_beginthread(&th01, 0, &n);
======= END code that starts the thread =======
======= BEGIN contents of Project Status Box =====
Building C:\BU\Pellus_C_projects\Test02\output\main.obj.
C:\BU\Pellus_C_projects\Test02\main.c(231): warning #2145: Assignment of 'void __fastcall function
(void *)' to 'void __cdecl function(void *)'.
Building C:\BU\Pellus_C_projects\Test02\output\main.res.
Building C:\BU\Pellus_C_projects\Test02\Test02.exe.
Done.
======= END contents of Project Status Box =====