01. september 2003 - 16:16Der er
2 kommentarer og 1 løsning
Oversæt dette VB6 hvordan ?
Hej alle.
Hvordan får jeg oversat flg. til Visual Basic 6
CString strCommand; //Binary command to be executed char arCommand[16]; //Array for the command to be executed DCB dcb; OVERLAPPED ovWrite; memset(&ovWrite,0,sizeof(ovWrite));
Det er en del af en længere c++ kode som skal sætte nogle bit på comporten, bittene sætte i forhold til strCommand, hvis du kan/vil oversætte hele koden, vil jeg give 200 point for det.
Koden er en del af en ActiveX control, men skal "bare" være en Sub i VB
BOOL CAtmel2xCtrl::Erase() { MessageBox("Erase Function"); CString strCommand; //Binary command to be executed char arCommand[16]; //Array to hold the command to be executed DCB dcb; OVERLAPPED ovWrite; memset(&ovWrite,0,sizeof(ovWrite)); int nLength = 0;
int d; for(d=0;d<=100000;d++) EscapeCommFunction(m_hCommPort, SETBREAK);
//Change the state of DTR according to the command in the arCommand while (arCommand[nLength] != '\0') { switch(arCommand[nLength]) { case '0': { EscapeCommFunction( m_hCommPort, CLRDTR); EscapeCommFunction(m_hCommPort,SETRTS); //MessageBox("CLRRTS"); for(d=0;d<=50000;d++); EscapeCommFunction(m_hCommPort,CLRRTS); for(d=0;d<=50000;d++); break; } case '1': { EscapeCommFunction( m_hCommPort, SETDTR); EscapeCommFunction(m_hCommPort,SETRTS); //MessageBox("SETRTS"); for(d=0;d<=50000;d++); EscapeCommFunction(m_hCommPort,CLRRTS); for(d=0;d<=50000;d++); break; } } nLength++; } EscapeCommFunction(m_hCommPort, CLRRTS); //SCK = 0
//Change the state of DTR according to the command in the arCommand while (arCommand[nLength] != '\0') { switch(arCommand[nLength]) { case '0': { EscapeCommFunction( m_hCommPort, CLRDTR); EscapeCommFunction(m_hCommPort,SETRTS); //MessageBox("CLRRTS"); for(d=0;d<=50000;d++); EscapeCommFunction(m_hCommPort,CLRRTS); for(d=0;d<=50000;d++); break; } case '1': { EscapeCommFunction( m_hCommPort, SETDTR); EscapeCommFunction(m_hCommPort,SETRTS); //MessageBox("SETRTS"); for(d=0;d<=50000;d++); EscapeCommFunction(m_hCommPort,CLRRTS); for(d=0;d<=50000;d++); break; } } nLength++; }
//Change the state of DTR according to the command in the arCommand while (arCommand[nLength] != '\0') { switch(arCommand[nLength]) { case '0': { EscapeCommFunction( m_hCommPort, CLRDTR); EscapeCommFunction(m_hCommPort,SETRTS); //MessageBox("CLRRTS"); for(d=0;d<=50000;d++); EscapeCommFunction(m_hCommPort,CLRRTS); for(d=0;d<=50000;d++); break; } case '1': { EscapeCommFunction( m_hCommPort, SETDTR); EscapeCommFunction(m_hCommPort,SETRTS); //MessageBox("SETRTS"); for(d=0;d<=50000;d++); EscapeCommFunction(m_hCommPort,CLRRTS); for(d=0;d<=50000;d++); break; } } nLength++; }
//EscapeCommFunction(m_hCommPort, CLRBREAK); CloseHandle(m_hCommPort); MessageBox("Unit loaded without errors."); return TRUE;
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.