2006-07-25 10:04:14 -04:00
|
|
|
! Copyright (C) 2005, 2006 Doug Coleman.
|
|
|
|
! See http://factor.sf.net/license.txt for BSD license.
|
2006-08-01 18:59:56 -04:00
|
|
|
USING: alien errors io kernel math namespaces parser prettyprint words ;
|
2006-07-25 10:04:14 -04:00
|
|
|
IN: win32-api
|
|
|
|
|
2006-08-01 18:59:56 -04:00
|
|
|
: (win32-error) ( id -- string )
|
|
|
|
#! In f.exe
|
|
|
|
"char*" f "error_message" [ "int" ] alien-invoke ;
|
|
|
|
|
|
|
|
: win32-error ( -- ) GetLastError dup 0 = [ (win32-error) throw ] unless drop ;
|
|
|
|
|
2006-07-25 10:04:14 -04:00
|
|
|
: win32-error=0 zero? [ win32-error ] when ;
|
|
|
|
: win32-error>0 0 > [ win32-error ] when ;
|
|
|
|
: win32-error<0 0 < [ win32-error ] when ;
|
|
|
|
: win32-error<>0 zero? [ win32-error ] unless ;
|
|
|
|
|
|
|
|
: lo-word ( wparam -- lo ) HEX: ffff bitand ;
|
|
|
|
: hi-word ( wparam -- hi ) -16 shift ;
|
|
|
|
|
|
|
|
: msgbox ( str -- )
|
|
|
|
f swap "DebugMsg" MB_OK MessageBox drop ;
|
|
|
|
|