Writing to Communication Ports in FoxPro for Windows

Last reviewed: December 19, 1996
Article ID: Q99553
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, versions 3.0, 5.0
  • Microsoft FoxPro for Windows, versions 2.5 and 2.5a

SUMMARY

Communication ports cannot be opened in FoxPro for Windows using low-level file functions; this will always return a negative result. This type of functionality can only be accomplished by making calls to the Windows application programming interface (API) through FoxPro by using Foxtools.fll.

NOTE: For backward compatibility, Visual FoxPro still supports FOXTOOLS.FLL (included in earlier FoxPro versions), the Visual FoxPro API library that allows calls to 16-bit .DLL functions. However, in Visual FoxPro, the DECLARE command is the preferred method for calling .DLL functions.

MORE INFORMATION

Foxtools.fll is an API library that allows FoxPro for Windows programs to call any Windows DLL (dynamic-link library) that supports the following criteria:

  1. Arguments of type integer, long, float, double, and string/buffer. These may be passed by reference or by value.

  2. Return types of integer, long, float, double, and string/buffer. These are returned by value only.

The following FOXTOOLS.FLL functions are used to provide this type of functionality:

   RegFn() - Registers a function and the arguments it takes.
   CallFn() - Calls a registered function.

With the exception of RegFn() and CallFn(), the functions provided in FOXTOOLS.FLL are not supported by Microsoft Product Support either electronically or via telephone.

NOTE: It is not possible to use a 16-bit application such as FoxPro for Windows 2.x to call a 32-bit operating system DLL such as Kernel32.dll in Windows 95 or Windows NT.

REFERENCES

Microsoft Windows Software Development Kit "Programming Windows 3.1" by Charles Petzold, Microsoft Press "Microsoft Systems Journal" Microsoft Win32 Software Development Kit for Windows NT Microsoft MS-DOS "Programmer's Reference"


Additional reference words: 5.00 VFoxWin 3.00 FoxWin 2.50 2.50a com port
KBCategory: kbinterop kbtool kbprg
KBSubcategory: FxprgFoxtools


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: December 19, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.