This is part of Win16 API which allow to create versions of program from one source code to run under OS/2 and Win16. Under OS/2 program can be running under Win-OS/2 if program is Windows NE executable, and with help on Windows Libraries for OS/2, if it is OS/2 NE executable. Here is a WLO to OS/2 API mapping draft
The MessageBox function creates, displays, and operates a message box. The message box contains an application-defined message and title, plus any combination of predefined icons and push buttons.
int MessageBox(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType);
Buttons:
Icons:
Default Button:
Modality:
Other:
The function returns zero if there is not enough memory to create the message box. If the call succeeds, the return value is one of the following menu-item values:
#include <windows.h> int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // Simple information message box MessageBox(NULL, "Hello, world! This is a message from Janus.", "Win16 Example", MB_OK | MB_ICONINFORMATION); // Question message box with Yes/No/Cancel int result = MessageBox(NULL, "Do you want to save changes?", "Confirmation", MB_YESNOCANCEL | MB_ICONQUESTION | MB_DEFBUTTON1); // Handle the result if (result == IDYES) { MessageBox(NULL, "You chose Yes", "Result", MB_OK | MB_ICONINFORMATION); } else if (result == IDNO) { MessageBox(NULL, "You chose No", "Result", MB_OK | MB_ICONINFORMATION); } else if (result == IDCANCEL) { MessageBox(NULL, "You chose Cancel", "Result", MB_OK | MB_ICONWARNING); } // Error message example MessageBox(GetActiveWindow(), "File not found. Please check the path.", "Error", MB_OK | MB_ICONSTOP | MB_SYSTEMMODAL); return 0; }
; Example for MASM (Microsoft Macro Assembler) ; Assemble with: MASM /MX program.asm ; Link with: LINK program.obj,,,libw.lib,, .MODEL LARGE .386 INCLUDE windows.inc .DATA msg_hello DB "Hello, world!", 0 cap_hello DB "Greeting", 0 msg_question DB "Continue operation?", 0 cap_question DB "Question", 0 msg_yes DB "You pressed Yes", 0 msg_no DB "You pressed No", 0 msg_cancel DB "Operation cancelled", 0 cap_result DB "Result", 0 .CODE START PROC FAR ; Initialize push ds pop ax xor ax, ax ; Simple message box push MB_OK OR MB_ICONINFORMATION ; uType push OFFSET cap_hello ; lpCaption push OFFSET msg_hello ; lpText push 0 ; hWnd = NULL call MessageBox ; Question message box push MB_YESNOCANCEL OR MB_ICONQUESTION ; uType push OFFSET cap_question ; lpCaption push OFFSET msg_question ; lpText push 0 ; hWnd = NULL call MessageBox ; Check result (result is in AX) cmp ax, IDYES je show_yes cmp ax, IDNO je show_no cmp ax, IDCANCEL je show_cancel jmp exit_program show_yes: push MB_OK OR MB_ICONINFORMATION push OFFSET cap_result push OFFSET msg_yes push 0 call MessageBox jmp exit_program show_no: push MB_OK OR MB_ICONINFORMATION push OFFSET cap_result push OFFSET msg_no push 0 call MessageBox jmp exit_program show_cancel: push MB_OK OR MB_ICONWARNING push OFFSET cap_result push OFFSET msg_cancel push 0 call MessageBox exit_program: ; Exit program mov ax, 4C00h int 21h START ENDP END START
| Group | Functions |
|---|---|
| Module manager | GETVERSION GETMODULEHANDLE GETMODULEUSAGE GETMODULEFILENAME GETPROCADDRESS MAKEPROCINSTANCE FREEPROCINSTANCE GETINSTANCEDATA CATCH THROW GETCODEHANDLE LOADLIBRARY |
| Global Memory Manager | GlobalAlloc GlobalCompact GlobalDiscard GlobalFree GlobalLock GlobalReAlloc GlobalSize GlobalUnlock GlobalFlags |
| Local Memory Manager | LocalInit LocalAlloc LocalCompact LocalDiscard LocalFree LocalLock LocalFreeze LocalMelt LocalReAlloc LocalSize LocalUnlock LocalHandleDelta LockData UnlockData LocalFlags |
| Task Scheduler | GetCurrentTask Yield SetPriority |
| Resource Manager | AddFontResource RemoveFontResource LoadBitmap LoadCursor LoadIcon LoadMenu LoadString LoadAccelerators FindResource LoadResource AllocResource LockResource FreeResource AccessResource SizeofResource SetResourceHandler |
| String Translation | AnsiUpper AnsiLower AnsiNext AnsiPrev |
| Atom Manager | InitAtomTable AddAtom DeleteAtom FindAtom GetAtomName |
| Windows Initialization File | GetProfileInt GetProfileString WriteProfileString |
| Debugging | FatalExit |
| File I/O | _lopen _lcreat _llseek _lread _lwrite _lclose OpenFile GetTempFileName GetTempDrive |
| Registry | RegOpenKey RegCreateKey RegCloseKey RegDeleteKey RegSetValue RegQueryValue RegEnumKey |