The Globals structure contains various functions to operate on handles, functions to obtain handles to the Poly/ML application and window and a function to get error information.
structure Globals : sig type 'a HANDLE type HINSTANCE type HWND val hNull : 'a HANDLE val handleOfInt : int -> 'a HANDLE val intOfHandle : 'a HANDLE -> int val isHNull : 'a HANDLE -> bool val ApplicationInstance : unit -> HINSTANCE val GetLastError : unit -> OS.syserror val MainWindow : unit -> HWND end
type 'a HANDLE
hNull : 'a HANDLE
handleOfInt(i): 'a HANDLE
ML Extension: All handles, such as HWND and HBITMAP, are instances of the 'a HANDLE type. Generally the Windows functions which can take NULL as a valid argument or return NULL as a valid result take option types. Occasionally it may be necessary to pass NULL in other circumstances in which case hNull can be used in ML. There are also a few occasions where a handle has to be cast to or from int. handleOfInt and intOfHandle can be used for this.
ML Extension: Returns the application instance handle passed in to the WinMain function when Poly/ML was started.
ML Extension: Returns the handle to the Poly/ML window.
Returns the error code for the last function call. Generally when a function fails an exception is raised including the last error as part of the exception packet.