-module(msgbox). -compile([export_all]). pause(X) -> receive after X -> ok end. main() -> spawn(fun heartbeat/0), pause(1000), {ok, User32} = ffi:load_library_win("user32"), Answer = ffi:call_block(User32, "MessageBoxA", [0, "Erlang VM is now blocked by your call", "Erlang", 4]), io:format("You have pressed '~p'\n", [msgbox(Answer)]), pause(1000), Answer2 = ffi:call(User32, "MessageBoxA", [0, "Erlang VM is not blocked now if you have " "specified +A option to erl", "Erlang", 4]), io:format("You have pressed '~s'\n", [msgbox(Answer2)]), pause(1000), erlang:halt(). msgbox(6) -> yes; msgbox(7) -> no; msgbox(X) -> X. heartbeat() -> io:format("alive!~n", []), pause(500), heartbeat().