DOCUMENT:Q121416  10-NOV-1994  [FOXPRO]
TITLE   :PRB: GetPrivateProfileString() Generates "Data Type Mismatch"
PRODUCT :Microsoft FoxPro
PROD/VER:2.5x 2.60 2.60a
OPER/SYS:WINDOWS
KEYWORDS:kbprg kberrmsg

--------------------------------------------------------------------
The information in this article applies to:

 - Microsoft FoxPro for Windows, versions 2.x, 2.6, 2.6a
--------------------------------------------------------------------

SUMMARY
=======

When you call the GetPrivateProfileString) Windows API function from within
FoxPro for Windows and the UDFPARMS setting is REFERENCE, you will receive
the error message "Data type mismatch."

CAUSE
=====

This error occurs because GetPrivateProfileString() is expecting certain
parameters to be passed by VALUE. With the UDFPARMS set to REFERENCE, you
are sending all parameters by REFERENCE. The GetPrivateProfileString()
function returns an error because it is expecting these parameters by
VALUE. FoxPro interprets the error as a data type mismatch.

RESOLUTION
==========

To prevent this behavior, set UDFPARMS to VALUE.

MORE INFORMATION
================

Steps to Reproduce Behavior
---------------------------

Type the following commands in the Command window:

   SET LIBRARY TO SYS(2004)+"FOXTOOLS.FLL"
   MRETURN=REPLICATE(CHR(0), 144)
   MREGISTER=REGFN("GETPROFILESTRING","CCC@CI","I")
   MCALL=CALLFN(MREGISTER,"WINDOWS","LOAD","",@MRETURN,256)

The last command will return the error message "Data type mismatch."

Additional reference words: FoxWin 2.50 2.50a 2.50b 2.60 2.60a errmsg
KBCategory: kbprg kberrmsg
KBSubcategory:

=============================================================================

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.

Copyright Microsoft Corporation 1994.