I have developed an dll in C++(my favorite language) and I want to use this dll in foxpro. I am not sure what type in FoxPro is equal to VC++ short type.
If it's your .DLL, why not make it an INTEGER (4 bytes) and not worry about it?
Better yet, create a COM DLL (ActiveX) and make it much easier to inter face to VFP and other languages!
It seems to me that vfp's SHORT would be appropriate. This is from VFP7's help, but VFP6 doesn't choke on it (though I have no function with a SHORT parameter to try...): DECLARE - DLL Command SHORT 16-bit integer
INTEGER 32-bit integer
SINGLE 32-bit floating point
DOUBLE 64-bit floating point
LONG 32-bit long integer
STRING Character string
OBJECT IDispatch object type (I think VFP8 only)
From C++ help: Data Type Ranges
Type Name | Bytes | Other Names | Range of Values
int | * | signed, signed int | System dependent
unsigned int | * | unsigned | System dependent
__int8 | 1 | char, signed char | –128 to 127 __int16 | 2 | short, short int, signed short int | –32,768 to 32,767
__int32 | 4 | signed, signed int | –2,147,483,648 to 2,147,483,647
__int64 | 8 | none | –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
char | 1 | signed char | –128 to 127
unsigned char | 1 | none | 0 to 255 short | 2 | short int, signed short int | –32,768 to 32,767
unsigned short | 2 | unsigned short int | 0 to 65,535
long | 4 | long int, signed long int | –2,147,483,648 to 2,147,483,647
unsigned long | 4 | unsigned long int | 0 to 4,294,967,295
enum | * | none | Same as int
float | 4 | none | 3.4E +/- 38 (7 digits)
double | 8 | none | 1.7E +/- 308 (15 digits)
long double | 10 | none | 1.2E +/- 4932 (19 digits)
FYI: the page on the wiki for ApiStructureClass is now updated to correct support for SHORT and remove support for INTEGER (previously, INTEGER was incorrectly treated as a SHORT, but I think DWORD/LONG are already enough synonyms for the 4-byte integral type... INTEGER is confusing.)
INTEGER is confusing
Yes, I agree with that. But my very first reason for using LONG is because it is much shorter to type instead of INTEGER, especially in VFP6 (no intelisense ). I only use integer if from the API declaration is INT type.
But still sometimes I replace it with LONG (again, much shorter to type )
re:
Declare Short GetKeyState in User32 Integer KeyCode
I had been using the similar GetAsyncKeyState declared as an INTEGER, and it has worked fine... I had no Idea when I wrote that code that SHORT was not the same as INTEGER...
Yes, I also experienced with that kind of strange things. I even got a result from one API (sorry forgot which one) that when I declared as Integer is not the same with Long (the LONG is the correct one). Especially under Windows NT based. It is the other reason why I prefer to use LONG
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.