Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dialer Classes?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
Divers
Thread ID:
00290669
Message ID:
00297168
Vues:
42
Hi George

here's de code. I've hacked it about a bit trying to sort it but its essentially doing what you designed it to do.

The minus ones occur if I lock the port out by not letting the code close the handle, so I don't think thats a big mystery anymore. But even when it grabs a port, (with or without the line being open) the result of the "WriteFile(lnport, @lcmnd, LEN(lcmnd), @lnwritten, 0)" operation is always 1, so its failing to dial on an open or closed line.

Totally beyond me! Can't seem to trap anything!

as an incidental, can you explain how these definitions work?
I'm talking about:
#DEFINE WAITSECONDS 4
#DEFINE ID_CANCEL 2
etc.

I tried tracking their values to see if this was part of the problem but could not get debug even to recognise the values as the line was being executed! What white god magic this?

anyway, here's the code

#DEFINE WAITSECONDS 4
#DEFINE ID_CANCEL 2
#DEFINE MB_OKCANCEL 1
#DEFINE MB_ICONSTOP 16
#DEFINE MB_ICONINFORMATION 64
#DEFINE GENERIC_READ 0x80000000
#DEFINE GENERIC_WRITE 0x40000000
#DEFINE CF_TEXT CHR(13) + CHR(10)

DECLARE INTEGER WriteFile IN Win32API;
INTEGER hFile, STRING @lpbuffer,;
INTEGER nNumberOfBytesToWrite,;
INTEGER @lpNumberOfBytesWritten,;
STRING @lpOverlapped
DECLARE INTEGER CreateFile IN Win32API;
STRING @lpFileName, INTEGER dwDesiredAccess,;
INTEGER dwShareMode,;
STRING @lpSecurityAttributes, INTEGER dwCreationDisposition,;
INTEGER dwFlagsAndAttributes, INTEGER hTemplateFile
DECLARE INTEGER CloseHandle IN Win32API;
INTEGER hObject
DECLARE INTEGER FlushFileBuffers IN Win32API;
INTEGER hFile
DECLARE INTEGER GetLastError IN Win32API


LOCAL lcmsg, lnport, lnwritten, lcmnd,lnstop
commport=this.cport


lcmsg = "Please pickup the phone and choose OK to dial " + this.m_fone
IF MESSAGEBOX(lcmsg, MB_ICONINFORMATION + MB_OKCANCEL, "Dial Number") # ID_CANCEL
* lnport = CreateFile(CommPort, GENERIC_READ + GENERIC_WRITE, 0, 0, 3, 0, 0) && original
* lnport = CreateFile(@CommPort, GENERIC_READ + GENERIC_WRITE, 0, 0, 3, 0, 0) &&amended
lnport = CreateFile(@CommPort, 0x80000000 + 0x40000000, 0, 0, 3, 0, 0) && tried this to see if there
&& was a problem with GENERICs
IF lnport > 0
lnwritten = 0
lcmnd = "ATDT" + this.m_fone + CF_TEXT
dialok=WriteFile(lnport, @lcmnd, LEN(lcmnd), @lnwritten, 0) && modified to make dialok easier to debutg
IF dialok # 0
* IF WriteFile(lnport, @lcmnd, LEN(lcmnd), @lnwritten, 0) # 0
* Flush the buffer to assure the data was written
= FlushFileBuffers(lnport)
* Wait to make sure it's been dialed
lnstop = SECONDS() + WAITSECONDS
DO WHILE SECONDS() < lnstop
DoEvents
ENDDO
* Hang up command
lcmnd = 'ATH0' + CF_TEXT
= WriteFile(lnport, @lcmnd, LEN(lcmnd), @lnwritten, 0)
= FlushFileBuffers(lnport)
* Close up
= CloseHandle(lnport)
ENDIF
else
lnerror = GetLastError()
wait window str(lnerror)
ENDIF
ENDIF
RETURN
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform