General information
Category:
Windows API functions
And nobody knows why it requires 40 bytes... :) Unless we have 5-byte words. :))
Vlad
>Hello Michel!
>
>Here is the aditional information about topic:
>
>Some DLL functions require more complex parameters, such as structures
>or arrays. If the function requires a pointer to a structure,
>you must determine the layout of the structure, then emulate it as a
>string in Visual FoxPro before passing it or receiving it from the DLL
> function. For example, the Windows system function GetSystemTime( )
>expects a pointer to a structure consisting of eight words or unsigned
> 16-bit integers indicating the year, month, day, and so on. The structure
> is defined this way:
>typedef struct _SYSTEMTIME {
> WORD wYear ;
> WORD wMonth ;
> WORD wDayOfWeek ;
> WORD wDay ;
> WORD wHour ;
> WORD wMinute ;
> WORD wSecond ;
> WORD wMilliseconds ;
>} SYSTEMTIME
>
>To pass data between Visual FoxPro and the GetSystemTime( ) function, you
> must create a 40-byte string buffer (consisting initially of spaces) and
>then pass the address of this string to the function for it to fill in.
>When
> the string is returned, you must parse it in 2-byte increments to extract
> the individual fields of the structure. The following fragment illustrates
>how you could extract three of the fields from the structure:
>
>DECLARE INTEGER GetSystemTime IN win32api STRING @
>cBuff=SPACE(40)
>=GetSystemTime(@cBuff)
>
>tYear = ALLTRIM(STR(ASC(SUBSTR(cBuff,2)) * ;
> 256 + ASC(SUBSTR(cBuff,1))))
>tMonth = ALLTRIM(STR(ASC(SUBSTR(cBuff,4)) * ;
> 256 + ASC(SUBSTR(cBuff,3))))
>tDOW = ALLTRIM(STR(ASC(SUBSTR(cBuff,6)) * ;
> 256 + ASC(SUBSTR(cBuff,5))))
>
>
>I think that it must be in FAQ under topic "How to pass structures into
>Win32 API".
>
>Have a happy day
>Vladimir Shevchenko
>
>> However, the 3rd parameter says "A pointer to a buffer containing the
>user
>> information structure.".
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only