dating, anyone?

new topic     » topic index » view thread      » older message » newer message

A bit of 'educational' humour, I guess.

--date.exw
include dll.e
include machine.e
constant
 K32=open_dll("kernel32")
,GetDateFormat=define_c_func(K32,"GetDateFormatA",
       {C_UINT,C_UINT,C_POINTER,C_POINTER,C_POINTER,C_UINT},C_INT)
,LOCALE_USER_DEFAULT=#400,DATE_SHORTDATE=1,DATE_LONGDATE=2
,lstrlen=define_c_func(K32,"lstrlen",{C_POINTER},C_UINT)
function peek_zstring(atom lpzString)
 return peek({lpzString,c_func(lstrlen,{lpzString})})
end function
sequence langid, lang
langid={#406,#413,#409,#40C,#407,#410,#80A,#40F}
lang={"Danish","Dutch","British","French","German","Italian","Mexican","Icelandic"}
atom datebuffer, formatstring, jk
datebuffer=allocate(128)
formatstring=allocate_string("'a lazy' dddd', in' MMMM', in the year' yyyy
'eh?'")
jk=c_func(GetDateFormat,{LOCALE_USER_DEFAULT,0,0,formatstring,datebuffer,128})
printf(1,"%s\n",{peek_zstring(datebuffer)})--using formatstring
jk=c_func(GetDateFormat,{LOCALE_USER_DEFAULT,DATE_LONGDATE,0,0,datebuffer,128})
printf(1,"%s\n\n",{peek_zstring(datebuffer)})--default long date
--sometimes 'crap' in English DOSbox?
for i = 1 to length(langid) do
 jk=c_func(GetDateFormat,{langid[i],DATE_LONGDATE,0,0,datebuffer,128})
 printf(1,"%s   %s\n",{lang[i],peek_zstring(datebuffer)})
end for
jk=c_func(GetDateFormat,{LOCALE_USER_DEFAULT,DATE_SHORTDATE,0,0,datebuffer,128})
printf(1,"\n%s disappears in 20 seconds.",{peek_zstring(datebuffer)})
machine_proc(64,20)

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu