void CBulkusbDlg::OnButtonWritestart()
{
// TODO: Add your control notification handler code here
// TODO: Add your control notification handler code here
CString pipename;
SetTimer(1,1000,NULL);
CWinThread * wt = AfxBeginThread(
BulkWritePipe, // thread function
&m_BulkWrite); // argument to thread function
m_BulkWrite.hThread=wt->m_hThread;
}
void CBulkusbDlg::OnButtonWritestop()
{
// TODO: Add your control notification handler code here
// TODO: Add your control notification handler code here
m_BulkWrite.bInThread=FALSE;
EnableButton(true,false);
KillTimer(1);
m_calwritetime.bInThread=FALSE;
}
UINT BulkWritePipe(void * pParam)
{
char temp [80],cc[80];
BOOLEAN bResult = FALSE;
int nResult=0;
unsigned long nBytes = 0;
unsigned long nReadBytes=0;
int nflag=0,nflag1=0;
unsigned long totaltoTx=0, toTxNow=0, exitFlag=0,exitFlag1=0,toTxNow1=0,totaltoTx1=0;
struct CThreadParam * threadParam;
CBulkusbDlg* testDlg;
HANDLE hDevice;
HANDLE hFile;
unsigned char *pbRead = new unsigned char[1048575];
unsigned long __stdcall ISP1581_Write(HANDLE pipehandle,unsigned char *sendbuffer,unsigned long bufferlen,int waittime)
{
unsigned long nbytes=0,lasterror=0;
int i=0;
unsigned long tmpbufferlen=bufferlen;
OVERLAPPED os;
memset(&os,0,sizeof(OVERLAPPED));