.WINDOWS [function-name DLL-name]
(.WINDOWS "function-name arguments)
.WINDOWSL [function-name DLL-name]
(.WINDOWSL "function-name arguments)
.WINDOWS provides a limited interface to the Windows API. Its first input is either the name of the Windows API function or a list of two elements. The first element of that list is the function name and the second element is the name of the DLL where the function is located. Optional function parameters may be supplied. They will be pushed on the stack in Pascal order. Numbers are pushed as 16-bit integers, so if the function requires a 32-bit argument, you are required to supply two numbers. Symbols are pushed as ASCIIZ strings. Lists are converted to an ASCIIZ string. A bytearray may be used as a buffer for return values or for structures. When you supply a bytearray, the address of its data area is pushed. The output is the 16-bit integer outcome of the Windows API function. For converting output in a bytearray into a Logo word, Use TEXTARRAY.
You can use the .WINDOWSL command to obtain return values of 32 bit integers. This command requires a thorough knowledge of Windows API calls. Supplying wrong parameters to the function can crash Windows.
The following procedure displays a message box showing the text you supply as input along with YES and NO buttons. Depending on which button you select, the procedure outputs "TRUE or "FALSE. To display the message box, the Windows API function MessageBox is used.
TO QUERY :MSG
- LOCAL "ANSWER
- MAKE "ANSWER (.WINDOWS "MESSAGEBOX 0 :MSG "QUESTION 36)
- IF :ANSWER = 6 THEN OUTPUT "TRUE
- OUTPUT "FALSE
? QUERY [DO YOU WANT TO QUIT?]