I've been trying to figure out how to update a text box from a thread that is created by an app. I really don't know if I'm even trying to use the right syntax, but I know that the thread is created and does work, because I've used a message box to display the count. I need to write that to the window, but I'm not sure how to do so and I've tried a couple of things, but I keep getting compile errors like "'.SetWindowTextA' must have class/struct/union type" or "illegal call of non-static member function." Any help would be much appreciated.

void CWinThreadsDlg::OnWriteWindow( CString str )
   m_edit_output.SetWindowText( str );   //does put str in the text box

long WINAPI tFunc1( long lParam );  //prototype the thread code

//My global variables
HANDLE myThread;          //handle for my thread

typedef struct tParams{   //thread data struct
  bool quit;
  HANDLE myMutex;
  HANDLE mySemaphore;

pTParams myTParams;       //thread struct pointer

void CWinThreadsDlg::OnButtonStart()
  EnableDisable(true);  //hides the start button, so only 1 thread can be made
  ThreadPriority priority = GetPriority();  //returns the radio button priority

  OnWriteWindow( "Started!" );

  .....create and init data struct.....

  // create the looping thread that will be dealt with
  myThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)tFunc1,myTParams,0,0);

  //set the thread's priority


// There is more button code here kill, stop, change priority.

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
// The Thead code!  Not necessarily in the same cpp file, so pass the quit variable/mutex/semaphore
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~

long WINAPI tFunc1( long lParam )
  pTParams thisTParams = (pTParams) lParam;  //point to my data struct

  int count = 0;
  bool stop = 0;

  while( !stop ) {
    Sleep( 1000 );   //wait 1 seconds
   //output count to window here, however that is done... ?
   CString out;
   out.Format("progress: %d", count);

   //I want to put the out string in the text box, I've tried these...
   //CWinThreadsDlg::m_edit_output.SetWindowText( out );
   count = (count + 1) % 101;  //0-100

   ...mutex stuff....


  ....semaphore stuff....

  return 0;
I'm not really sure how much of the code I have to post to fully flesh out the problem, I hope this is enough. The code to manipulate the thread all works, the problem is just getting the out string in the textbox from the thread.