1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<title>Windows Interface Reference: Globals structure</title> 6</head> 7 8<body> 9 10<h1>Globals </h1> 11 12<p>The Globals structure contains various functions to operate on handles, functions to 13obtain handles to the Poly/ML application and window and a function to get error 14information. </p> 15 16<pre>structure Globals : 17 sig 18 type 'a <a href="#Handles">HANDLE</a> 19 type HINSTANCE 20 type HWND 21 val <a 22href="#Handles">hNull</a> : 'a HANDLE 23 val <a href="#Handles">handleOfInt</a> : int -> 'a HANDLE 24 val <a 25href="#Handles">intOfHandle</a> : 'a HANDLE -> int 26 val <a href="#Handles">isHNull</a> : 'a HANDLE -> bool 27 28 val <a 29href="#ApplicationInstance">ApplicationInstance</a> : unit -> HINSTANCE 30 val <a 31href="#GetLastError">GetLastError</a> : unit -> OS.syserror 32 val <a 33href="#MainWindow">MainWindow</a> : unit -> HWND 34 end</pre> 35 36<p><tt><a name="Handles"></a>type 'a HANDLE<br> 37hNull : 'a HANDLE<br> 38handleOfInt(i): 'a HANDLE<br> 39intOfHandle(h): int<br> 40isHNull(h): bool</tt><br> 41<strong>ML Extension:</strong> All handles, such as HWND and HBITMAP, are instances of the 42'a HANDLE type. Generally the Windows functions which can take NULL as a valid argument or 43return NULL as a valid result take option types. Occasionally it may be necessary to 44pass NULL in other circumstances in which case hNull can be used in ML. There are 45also a few occasions where a handle has to be cast to or from int. handleOfInt and 46intOfHandle can be used for this.</p> 47 48<p><tt><a name="ApplicationInstance">ApplicationInstance</a>(): HINSTANCE</tt><br> 49<strong>ML Extension: </strong>Returns the application instance handle passed in to the 50WinMain function when Poly/ML was started.</p> 51 52<p><tt><a name="MainWindow">MainWindow</a>(): HWND</tt><br> 53<strong>ML Extension: </strong>Returns the handle to the Poly/ML window.</p> 54 55<p><tt><a name="GetLastError">GetLastErro</a>r(): OS.syserror</tt><br> 56Returns the error code for the last function call. Generally when a function fails 57an exception is raised including the last error as part of the exception packet.</p> 58</body> 59</html> 60