Click here to Skip to main content
16,015,504 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Search for Safe worker thread? Pin
Hans Ruck6-Mar-03 1:00
Hans Ruck6-Mar-03 1:00 
GeneralRe: Search for Safe worker thread? Pin
chen6-Mar-03 1:12
chen6-Mar-03 1:12 
GeneralRe: Search for Safe worker thread? Pin
Hans Ruck6-Mar-03 1:47
Hans Ruck6-Mar-03 1:47 
GeneralRe: Search for Safe worker thread? Pin
chen6-Mar-03 2:01
chen6-Mar-03 2:01 
GeneralRe: Search for Safe worker thread? Pin
chen6-Mar-03 2:21
chen6-Mar-03 2:21 
GeneralRe: Search for Safe worker thread? Pin
Hans Ruck6-Mar-03 2:38
Hans Ruck6-Mar-03 2:38 
GeneralRe: Search for Safe worker thread? Pin
chen6-Mar-03 2:59
chen6-Mar-03 2:59 
GeneralRe: Search for Safe worker thread? Pin
Hans Ruck6-Mar-03 3:11
Hans Ruck6-Mar-03 3:11 
Gee, you really are persistent Wink | ;)

Let's do it:
class CEfmraDlg : public CResizableDialog
{
  CWinThread *pThread; // = NULL in constructor
public:
  CEfmraDlg(CWnd* pParent = NULL);
  // the 
  virtual ~CEfmraDlg()
  {
    try 
    { 
      if (pThread)
        if (pThread->ExitInstance())    
          delete pThread;  
    }  
    catch(...)  
    {    
      TRACE("never mind\n");  
    }  
  }

  struct SToto
  {
    BOOL m_bToto;
  };
  static UINT StartThreadEfmRead (LPVOID param);
  bool m_bStop;
}

void CEfmraDlg::OnEfmRead()
{
  m_bStop = FALSE;
  SToto stToto;
  stToto.m_bToto = TRUE;
  
  pThread = AfxBeginThread(CEfmraDlg::StartThreadEfmRead, this);
}

UINT CEfmraDlg::StartThreadEfmRead (LPVOID param)
{
  char buff1[100];
  
  CEfmraDlg* ts = (CEfmraDlg*)param;
  
  if(ts->m_scsi.EFM_open(newSparam) == 0)
  {
    FILE *fp;
    if( NULL == (fp = fopen("cd.txt", "wb")))
    {
      ts->m_ListBox.AddString("Open cd.txt error");
    }
    
    ts->m_ListBox.AddString("Read CD begin ...");
    int count = 0;
    for(; count<=256*1024; )
    {
      count++; //256k
      if(ts->m_bStop) 
      {
        ts->m_ListBox.AddString("Read EFM data aborted.");
        fclose(fp);
        AfxEndThread(0);
      }
      
      if(ts->m_scsi.EFM_read(fp))
      {
        ts->m_ListBox.AddString("Read Error!");
        fclose(fp);
        AfxEndThread(0);
      } 
      memset(buff1, 0, 100);
      sprintf(buff1,"CD Reading - Count: %d Bytes: %d", count, count*256*1024);
      ts->m_diff = buff1;
      ts->ShowText();
    }
    ts->m_scsi.EFM_close();
    fclose(fp);
    AfxEndThread (0);
  }
  return 1;
}


rechi
Generalc library Pin
ferdykdb5-Mar-03 15:47
ferdykdb5-Mar-03 15:47 
GeneralDetecting Dynamic Drives Pin
BlinkyBill5-Mar-03 15:25
BlinkyBill5-Mar-03 15:25 
GeneralRe: Detecting Dynamic Drives Pin
Brian Shifrin6-Mar-03 2:16
Brian Shifrin6-Mar-03 2:16 
GeneralRe: Detecting Dynamic Drives Pin
BlinkyBill6-Mar-03 11:22
BlinkyBill6-Mar-03 11:22 
GeneralRe: Detecting Dynamic Drives Pin
Brian Shifrin6-Mar-03 12:49
Brian Shifrin6-Mar-03 12:49 
GeneralRe: Detecting Dynamic Drives Pin
Brian Shifrin6-Mar-03 12:51
Brian Shifrin6-Mar-03 12:51 
GeneralRe: Detecting Dynamic Drives Pin
BlinkyBill6-Mar-03 13:24
BlinkyBill6-Mar-03 13:24 
GeneralWindows Explorer Folders Pin
MajinRyan5-Mar-03 15:18
MajinRyan5-Mar-03 15:18 
GeneralRe: Windows Explorer Folders Pin
Michael Dunn5-Mar-03 17:03
sitebuilderMichael Dunn5-Mar-03 17:03 
Generalchar array error Pin
act_x5-Mar-03 14:56
act_x5-Mar-03 14:56 
GeneralRe: char array error Pin
Michael Dunn5-Mar-03 15:01
sitebuilderMichael Dunn5-Mar-03 15:01 
GeneralAutomating install tasks... Pin
el davo5-Mar-03 14:50
el davo5-Mar-03 14:50 
GeneralInstalling GDI+ (and Platform SDK questions etc) Pin
JeffBAbil5-Mar-03 14:30
JeffBAbil5-Mar-03 14:30 
GeneralRe: Installing GDI+ (and Platform SDK questions etc) Pin
Anders Molin5-Mar-03 14:47
professionalAnders Molin5-Mar-03 14:47 
GeneralRe: Installing GDI+ (and Platform SDK questions etc) Pin
Michael Dunn5-Mar-03 15:03
sitebuilderMichael Dunn5-Mar-03 15:03 
GeneralRe: Installing GDI+ (and Platform SDK questions etc) Pin
Anders Molin5-Mar-03 15:24
professionalAnders Molin5-Mar-03 15:24 
GeneralRe: Installing GDI+ (and Platform SDK questions etc) Pin
Joe Woodbury5-Mar-03 19:28
professionalJoe Woodbury5-Mar-03 19:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.