Semen,
Thank you. In the meantime I found out, that using BYCOPY also works.
If you want to see an example then download my recently posted "get certain weekday from month" routine.
Regards,
Egbert
------------------
[This message has been edited by Egbert Zijlema (edited July 06, 2000).]
Announcement
Collapse
No announcement yet.
equivalent for BYVAL %NULL?
Collapse
X
-
Egbert --
You can do something like this
Code:#Compile Exe #Register None #Dim All #Include "Win32Api.Inc" Function MakeDate(sFormat As String) As String Local szText As Asciiz * 255, FormatAddr As Dword, Flags As Dword If sFormat = "SHORTDATE" Then Flags = %DATE_SHORTDATE: FormatAddr = 0 Else _ If sFormat = "LONGDATE" Then Flags = %DATE_LONGDATE: FormatAddr = 0 Else _ Flags = 0: FormatAddr = StrPtr(sFormat) GetDateFormat %LOCALE_USER_DEFAULT, Flags, ByVal %Null, ByVal FormatAddr, szText, SizeOf(szText) Function = szText End Function Function PbMain MsgBox "ShortDate is " + MakeDate ("SHORTDATE") MsgBox "LongDate is " + MakeDate ("LONGDATE") MsgBox "Custom format is " + MakeDate("dddd dd/MM/yyyy") End Function
------------------
Leave a comment:
-
equivalent for BYVAL %NULL?
Hello folks,
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).]Tags: None
Leave a comment: