Hi!
Find a struct.zip class here at UT and it might help you a lot!
As about the question, it should be:
chr(157)+chr(0)+chr(0)+chr(0)+replicate(chr(0), 153)
Lower bytes of the integer value in the memory contain lower parts.
HTH.
>I'm using a function from a DLL which needs a structure as one of the parameters.
> In VFP's help file I found following under
Chapter 27: Extending Visual FoxPro with External Libraries>
>
>typedef struct _SYSTEMTIME {
> WORD wYear ;
> WORD wMonth ;
> WORD wDayOfWeek ;
> WORD wDay ;
> WORD wHour ;
> WORD wMinute ;
> WORD wSecond ;
> WORD wMilliseconds ;
>} SYSTEMTIME
>
>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))))
>
>
>Well. I'm a bit confused here how they got that
cBuff has to be of size 40, when each word is only a size 2 and there is only 8 words, which I see as size 8*2 = 16. It says that you must create a 40-byte string buffer. Why?
>
>But back to my function in the DLL and its structure, which looks like this
>
>typedef struct _INITDATA
>{
> DWORD dwSize;
> DWORD dwVersionMajor;
> DWORD dwVersionMinor;
> DWORD dwVersionBuild;
> DWORD dwOptions;
> DWORD dwReserved1;
> DWORD dwReserved2;
> char szDescription[MAXDESCRIPTIONLENGTH+1];
>
>} INITDATA, FAR* LPINITDATA;
>
>
>All I need is to make sure that
dwSize is the value of the size of the structure. Since it is a Double Word I would imagine the have size of 4 so I tried following (MAXDESCRIPTIONLENGTH is 128) strings
>
>chr(157)+chr(0)+chr(0)+chr(0)+replicate(chr(0), 153)
>chr(0)+chr(157)+chr(0)+chr(0)+replicate(chr(0), 153)
>chr(0)+chr(0)+chr(157)+chr(0)+replicate(chr(0), 153)
>chr(0)+chr(0)+chr(0)+chr(157)+replicate(chr(0), 153)
>
>Or chr(156) and 152 replicated chr(0)'s or chr(32)'s.
>
>Any help here would be great. TIA,
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.