<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Windows Interface Reference: Globals structure</title> </head> <body> <h1>Globals </h1> <p>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. </p> <pre>structure Globals : sig type 'a <a href="#Handles">HANDLE</a> type HINSTANCE type HWND val <a href="#Handles">hNull</a> : 'a HANDLE val <a href="#Handles">handleOfInt</a> : int -> 'a HANDLE val <a href="#Handles">intOfHandle</a> : 'a HANDLE -> int val <a href="#Handles">isHNull</a> : 'a HANDLE -> bool val <a href="#ApplicationInstance">ApplicationInstance</a> : unit -> HINSTANCE val <a href="#GetLastError">GetLastError</a> : unit -> OS.syserror val <a href="#MainWindow">MainWindow</a> : unit -> HWND end</pre> <p><tt><a name="Handles"></a>type 'a HANDLE<br> hNull : 'a HANDLE<br> handleOfInt(i): 'a HANDLE<br> intOfHandle(h): int<br> isHNull(h): bool</tt><br> <strong>ML Extension:</strong> 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.</p> <p><tt><a name="ApplicationInstance">ApplicationInstance</a>(): HINSTANCE</tt><br> <strong>ML Extension: </strong>Returns the application instance handle passed in to the WinMain function when Poly/ML was started.</p> <p><tt><a name="MainWindow">MainWindow</a>(): HWND</tt><br> <strong>ML Extension: </strong>Returns the handle to the Poly/ML window.</p> <p><tt><a name="GetLastError">GetLastErro</a>r(): OS.syserror</tt><br> 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.</p> </body> </html>