Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
PEMS and windows 9.x dialer.exe
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00267631
Message ID:
00268049
Views:
35
Hi Neil,

>Hi George,
>
>Man don't you ever rest. Thanx again.

Oh I rest plenty.< g > Come 5 PM (EDT) I quit (for the most part) worrying about VFP and projects, etc. Yeah, sometimes I get on-line after that, but that's the exception rather than the rule.

>I downloaded the access 97/ phone dialer article. Please forgive my lack of experience with APIs. May I impose on you one more time? I agree that the access code looks alot like vfp. I however, have little to no experience with APIs including the very basics of declaration statements. May I see the access to vfp conversion you performed to get the code to run in vfp? And the big question. Why is this better than making calls to foxtools?
>
Let me answer the last question first. As I mentioned in the other thread, using foxtools to register calls to a obsolete, unsupported 16 bit routine isn't the best idea. Don't get me wrong, I load foxtools in every application (early< g >) and find it very useful. I don't use it, however, to register API calls. VFP gives us the necessary syntax and using it presents far more readable code (IMHO). That out of the way (and without further ado or adon't< g >) here's a rough translation of that article
#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

PROCEDURE DialNumber
  
  LPARAMETERS PhoneNumber, CommPort
  
  LOCAL lcmsg, lnport, lnwritten, lcmnd,;
    lnstop
  lcmsg = "Please pickup the phone and choose OK to dial " + PhoneNumber
  IF MESSAGEBOX(lcmsg, MB_ICONINFORMATION + MB_OKCANCEL, "Dial Number") # ID_CANCEL
    lnport = CreateFile(CommPort, GENERIC_READ + GENERIC_WRITE, 0, 0, 3, 0, 0)
    IF lnport > 0
      lnwritten = 0
      lcmnd = "ATDT" + PhoneNumber + CF_TEXT
      IF WriteFile(lnport, @lccmnd, 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
        lccmnd = 'ATH0' + CF_TEXT
        = WriteFile(lnport, @lccmnd, LEN(lcmnd), @lnwritten, 0)
        = FlushFileBuffers(lnport)
        * Close up
        = CloseHandle(lnport)
      ENDIF
    ENDIF
  ENDIF
  RETURN
ENDPROC
You may want to modify it a bit to fit your usage.

Let me know if I can be of further help.
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform