Hello folks,
I've encountered a problem with GetDateFormat. In WIN32API.INC this API is declared as follows:
You can use this in 2 ways. Either you pass %DATE_LONGDATE (or shortdate) through dwFlags and BYVAL %NULL through lpFormat, or you pass a special format (such as "MMMM d") through lpFormat, while dwFlags is zero.
First strange thing: lpFormat is declared as a null-terminated string, but in case you want to leave it empty, BYVAL %NULL, which is a numeric!, is the correct param. By what can you replace this, eventually? I want to build a FUNCTION that uses this API, but in such a way that it passes the correct variables through dwFlags or lpFormat, depending of the content of a param passed.
This is the idea:
I tried several sorts of string operands, but nothing worked. The only thing I can get working is an IF...ELSE structure with 2 complete API-calls, but that's not what I want. I just want to alter the vars and then use the same API-call for both situations.
Any idea? Thanks in advance.
Regards,
Egbert
------------------
[This message has been edited by Egbert Zijlema (edited July 04, 2000).]
I've encountered a problem with GetDateFormat. In WIN32API.INC this API is declared as follows:
Code:
DECLARE FUNCTION GetDateFormat LIB "KERNEL32.DLL" _ ALIAS "GetDateFormatA" (BYVAL Locale AS LONG, _ BYVAL dwFlags AS LONG, _ lpDate AS SYSTEMTIME, _ lpFormat AS ASCIIZ, _ lpDateStr AS ASCIIZ, _ BYVAL cchDate AS LONG) AS LONG
First strange thing: lpFormat is declared as a null-terminated string, but in case you want to leave it empty, BYVAL %NULL, which is a numeric!, is the correct param. By what can you replace this, eventually? I want to build a FUNCTION that uses this API, but in such a way that it passes the correct variables through dwFlags or lpFormat, depending of the content of a param passed.
This is the idea:
Code:
FUNCTION MakeDate(sFormat AS STRING) AS STRING LOCAL lFormat AS LONG, st AS SYSTEMTIME, szText AS ASCIIZ * 255 lFormat = VAL(sFormat) IF lFormat = 1 OR lFormat = 2 THEN sFormat = xxxx [here I need a valid replacement for BYVAL %NULL] GetDateFormat %LOCALE_USER_DEFAULT, lFormat, st, sFormat, szText, SIZEOF(szText) FUNCTION = szText END FUNCTION
Any idea? Thanks in advance.
Regards,
Egbert
------------------
[This message has been edited by Egbert Zijlema (edited July 04, 2000).]
Comment