Download PC communication module/utility Working under
Transcript
Chapter 4. Usage of the communication DLL by softoware
4-1. How to use C_COMW.DLL under C/C++ language environment
The c_comw.dll executes a single communication command in one connection line such like c_comw.exe.
<Usage>
DLL File Name:
Function Name:
Parameter:
Return value:
C_COMW.DLL
InitC_COMW
LPSTR prt, int mess
Prt
string defined like "C_Comw.dll". Refer to <Parameter list> section
Mess
To display result dialog of the communication result.
0 is not displayed result, 1 is displayed result.
int
result
// This return value is int.(32bit)
result - 0: Normal end.
Others: Error end error code.
<Example of coding>
typedef int (*PROCCER1)(LPSTR,int);
PROCCER1 lpfnInitC_Comw;
// This return value is int.(32bit)
HINSTANCE hinstSamp = ::LoadLibrary("C_COMW.DLL");
if (hinstSamp == NULL)
MessageBox("LoadLibrary failed");
else
{
lpfnInitC_Comw = (PROCCER1)::GetProcAddress(hinstSamp,"InitC_COMW");
if (lpfnInitC_Comw == NULL)
MessageBox("GetProcAddress failed");
else
{
int Ret = 0;
// This return value is int.(32bit)
Ret = lpfnInitC_Comw("R FILE001P.TXT 1 -lo -dc:¥¥c_util.ini -i -T",1);
CString str; str.Format("Error : %d", Ret);
MessageBox(str);
}
::FreeLibrary(hinstSamp);
}
The detail of command string/parameter, please see other chapter.
(Chapter 5. C_comw.exe/dll command line/Dll parameter.)
- 11 -