i want to make simple program which will enable me to talk with my modem. For example, i send 'at' command, then modem returns 'OK'. Is there any API for easier communication with my modem, like
SendModemMessage("at", &TextBuffer);
???
thank you!
Use CreateFile to open the modem, then you can send commands to it. Like this :
.DATA
com1 BYTE "COM1", 0
hModem HANDLE 0 ; modem handle
bytesWritten DWORD 0
bytesReceived DWORD 0
BUFFER_SIZE = 256
buffer BYTE BUFFER_SIZE DUP ( 0 ) ; a buffer
command BYTE "atdt123456789", 0Dh, 0 ; command
commandSize = $ - command ; command size
.CODE
INVOKE CreateFile, ADDR com1, GENERIC_READ OR GENERIC_WRITE,1,NULL, OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL
mov hModem, eax
; to write the command
INVOKE WriteFile, hModem, ADDR command, commandSize, ADDR bytesWritten, 0
; to read the answer in buffer
INVOKE ReadFile, hModem, ADDR buffer, BUFFER_SIZE, ADDR bytesReceived, 0
Don't forget to check the return values of WriteFile and CreateFile.
This message was edited by karim, on 7/3/2001 3:35:44 AM