請問這是一個由VC++ LINK 出來的檔, 該如何於 VB6 的模組裡宣告
檔名: IOPORT.DLL 裡的一個 FUNCTION
//-------------------------------------------------------// FUNCTION:IOP_Read(int port, LPSTR buffer, int count)
//
// PORPOSE:Read characters from a specified serial port.
//--------------------------------------------------------
DWORD APIENTRY IOP_Read(int port, LPSTR buffer, int count)
{
BOOL fReadStat ;
DWORD dwError;
DWORD dwBytesRead ;
memset( buffer, 0x0, 256 ) ;
fReadStat = ReadFile( COMDEV[port], buffer, count,
&dwBytesRead, &READ_OS ) ;
if (!fReadStat)
{
if (GetLastError() == ERROR_IO_PENDING)
{
// We have to wait for read to complete
while(!GetOverlappedResult( COMDEV[port],
&READ_OS, &dwBytesRead, TRUE ))
{
dwError = GetLastError() ;
if (dwError == ERROR_IO_INCOMPLETE)
return (dwBytesRead) ;
else
return (FAIL) ;
}
}
else
return (FAIL) ;
}
return (dwBytesRead) ;
}