dmcwincppWord格式.docx
《dmcwincppWord格式.docx》由会员分享,可在线阅读,更多相关《dmcwincppWord格式.docx(25页珍藏版)》请在冰豆网上搜索。
![dmcwincppWord格式.docx](https://file1.bdocx.com/fileroot1/2023-1/10/9110b631-1f56-492b-9da8-9aa959755e2b/9110b631-1f56-492b-9da8-9aa959755e2b1.gif)
m_bConnected=FALSE;
m_hDmc=-1;
m_lLastError=0;
#ifdefDMCMULTIPLETHREADS
InitializeCriticalSection(&
m_CritSec);
#endif
}
CDMCWin(USHORTusController,HWNDhWnd,LONGlThreadID)
m_usController=usController;
m_hWnd=hWnd;
m_lThreadID=lThreadID;
if(m_usController>
0&
&
m_usController<
17)
{
EnterCriticalSection(&
if(m_lThreadID)
m_lLastError=DMCOpen2(m_usController,m_lThreadID,&
m_hDmc);
else
m_lLastError=DMCOpen(m_usController,m_hWnd,&
LeaveCriticalSection(&
if(m_lLastError==0)
m_bConnected=TRUE;
else
m_hDmc=-1;
}
~CDMCWin()
if(m_hDmc!
=-1)
Close();
DeleteCriticalSection(&
LONGCDMCWin:
Open()
if(m_bConnected)
returnm_lLastError;
#endif
else
m_lLastError=DMCERROR_CONTROLLER;
returnm_lLastError;
Open(USHORTusController,HWNDhWnd,LONGlThreadID)
returnOpen();
HANDLEDMCCDMCWin:
GetHandle()
returnm_hDmc;
{
m_lLastError=DMCGetHandle(m_usController,&
returnm_hDmc;
}
return-1;
voidCDMCWin:
SethWnd(HWNDhWnd)
m_lLastError=DMCChangeInterruptNotification(m_hDmc,(long)hWnd);
};
SetThreadID(LONGlThreadID)
m_lLastError=DMCChangeInterruptNotification(m_hDmc,(long)lThreadID);
Close()
=-1)
m_lLastError=DMCClose(m_hDmc);
Command(constPSZpszCommand,PCHARpchResponse,ULONGcbResponse)
m_lLastError=DMCCommand(m_hDmc,(PSZ)pszCommand,pchResponse,cbResponse);
m_lLastError=DMCERROR_HANDLE;
FastCommand(constPSZpszCommand)
m_lLastError=DMCFastCommand(m_hDmc,(PSZ)pszCommand);
BinaryCommand(PBYTEpbCommand,ULONGulCommandLength,PCHARpchResponse,ULONGcbResponse)
m_lLastError=DMCBinaryCommand(m_hDmc,pbCommand,ulCommandLength,pchResponse,cbResponse);
GetUnsolicitedResponse(PCHARpchResponse,ULONGcbResponse)
m_lLastError=DMCGetUnsolicitedResponse(m_hDmc,pchResponse,cbResponse);
GetAdditionalResponseLen()
LONGlLength;
m_lLastError=DMCGetAdditionalResponseLen(m_hDmc,(PULONG)&
lLength);
if(m_lLastError!
=0)
lLength=0;
returnlLength;
GetAdditionalResponse(PCHARpchResponse,ULONGcbResponse)
m_lLastError=DMCGetAdditionalResponse(m_hDmc,pchResponse,cbResponse);
GetErrorText(LONGlError,PCHARpchMessage,ULONGcbMessage)
EnterCriticalSection(&
m_lLastError=DMCError(m_hDmc,lError,pchMessage,cbMessage);
LeaveCriticalSection(&
Clear()
m_lLastError=DMCClear(m_hDmc);
Reset()
m_lLastError=DMCReset(m_hDmc);
MasterReset()
m_lLastError=DMCMasterReset(m_hDmc);
GetVersion(PCHARpchVersion,ULONGcbVersion)
m_lLastError=DMCVersion(m_hDmc,pchVersion,cbVersion);
DownloadFile(constPSZpszFileName,constPSZpszLabel)
m_lLastError=DMCDownloadFile(m_hDmc,(PSZ)pszFileName,(PSZ)pszLabel);
DownloadFromBuffer(constPSZpszBuffer,constPSZpszLabel)
m_lLastError=DMCDownloadFromBuffer(m_hDmc,(PSZ)pszBuffer,(PSZ)pszLabel);
UploadFile(constPSZpszFileName)
m_lLastError=DMCUploadFile(m_hDmc,(PSZ)pszFileName);
UploadToBuffer(PCHARpchBuffer,ULONGcbBuffer)
m_lLastError=DMCUploadToBuffer(m_hDmc,pchBuffer,cbBuffer);
SendFile(constPSZpszFileName)
m_lLastError=DMCSendFile(m_hDmc,(PSZ)pszFileName);
SendBinaryFile(constPSZpszFileName)
m_lLastError=DMCSendBinaryFile(m_hDmc,(PSZ)pszFileName);
AsciiCommandToBinaryCommand(PSZpszAsciiCommand,ULONGulAsciiCommandLength,PBYTEpbBinaryResult,ULONGcbBinaryResult,ULONGFAR*pulBinaryResultLength)
m_lLastError=DMCCommand_AsciiToBinary(m_hDmc,pszAsciiCommand,ulAsciiCommandLength,pbBinaryResult,cbBinaryResult,pulBinaryResultLength);
BinaryCommandToAsciiCommand(PBYTEpbBinaryCommand,ULONGulBinaryCommandLength,PSZpszAsciiResult,ULONGcbAsciiResult,ULONGFAR*pulAsciiResultLength)
m_lLastError=DMCCommand_BinaryToAscii(m_hDmc,pbBinaryCommand,ulBinaryCommandLength,pszAsciiResult,cbAsciiResult,pulAsciiResultLength);
AsciiFileToBinaryFile(constPSZpszInputFileName,constPSZpszOutputFileName)
m_lLastError=DMCFil