en:docs:fapi:dosgetmessage

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en:docs:fapi:dosgetmessage [2018/08/31 08:36] – created prokusheven:docs:fapi:dosgetmessage [2021/09/17 06:13] (current) prokushev
Line 1: Line 1:
 +{{page>en:templates:fapiint}}
 +
 +====== DosGetMessage ======
 +
 Retrieves a message from the specified system message file, and inserts variable text-string information into the message. Retrieves a message from the specified system message file, and inserts variable text-string information into the message.
  
-==Syntax== +===== Syntax =====
- DosGetMessage (IvTable, IvCount, DataArea, DataLength, MsgNumber, FileName, MsgLength)+
  
-==Parameters== +<code c> 
-;IvTable (PCHAR FAR *) - input : Address of a list of double-word pointers. Each pointer points to an ASCIIZ or null-terminated DBCS string (variable insertion text). 0 to 9 strings can be present. +DosGetMessage (IvTableIvCount, DataArea, DataLength, MsgNumber, FileName, MsgLength) 
-;IvCount (USHORT) - input:Count of variable insertion text strings is 0-9. If IvCount is 0IvTable is ignored. +</code>
-;DataArea (PCHAR) - output:Address of the requested message. If the message is too long to fit in the caller's bufferas much of the message text is returned as possible, with the appropriate error return code. +
-;DataLength (USHORT) - input:Lengthin bytesof the user's storage area. +
-;MsgNumber (USHORT) - input:Requested message number. +
-;FileName (PSZ) - input:Address of the optional drivepath, and filename of the file where the message can be found. If messages are bound to the .EXE file using MSGBIND utility, then filename is the name of the message file from which the messages are extracted. +
-;MsgLength (PUSHORT- output:Address of the length, in bytes, of the message.+
  
-==Return Codes== +===== Parameters ===== 
-rc (USHORT) - return+ 
 +  * IvTable ([[PCHAR]] FAR *) - input : Address of a list of double-word pointers. Each pointer points to an ASCIIZ or null-terminated DBCS string (variable insertion text). 0 to 9 strings can be present. 
 +  * IvCount ([[USHOR]]T) - input:Count of variable insertion text strings is 0-9. If IvCount is 0, IvTable is ignored. 
 +  * DataArea ([[PCHAR]]) - output:Address of the requested message. If the message is too long to fit in the caller's buffer, as much of the message text is returned as possible, with the appropriate error return code. 
 +  * DataLength ([[USHORT]]) - input:Length, in bytes, of the user's storage area. 
 +  * MsgNumber ([[USHORT]]) - input:Requested message number. 
 +  * FileName ([[PSZ]]) - input:Address of the optional drive, path, and filename of the file where the message can be found. If messages are bound to the .EXE file using MSGBIND utility, then filename is the name of the message file from which the messages are extracted. 
 +  * MsgLength ([[PUSHORT]]) - output:Address of the length, in bytes, of the message. 
 + 
 +===== Return Codes ===== 
 + 
 +rc ([[USHORT]]) - return
  
 Return code descriptions are: Return code descriptions are:
-* 0   NO_ERROR 
-* 2   ERROR_FILE_NOT_FOUND 
-* 206 ERROR_FILENAME_EXCED_RANGE 
-* 316 ERROR_MR_MSG_TOO_LONG 
-* 317 ERROR_MR_MID_NOT_FOUND 
-* 318 ERROR_MR_UN_ACC_MSGF 
-* 319 ERROR_MR_INV_MSFG_FORMAT 
-* 320 ERROR_MR_INV_IVCOUNT 
-* 321 ERROR_MR_UN_PERFORM 
  
-==Remarks==+  * 0   NO_ERROR 
 +  * 2   ERROR_FILE_NOT_FOUND 
 +  * 206 ERROR_FILENAME_EXCED_RANGE 
 +  * 316 ERROR_MR_MSG_TOO_LONG 
 +  * 317 ERROR_MR_MID_NOT_FOUND 
 +  * 318 ERROR_MR_UN_ACC_MSGF 
 +  * 319 ERROR_MR_INV_MSFG_FORMAT 
 +  * 320 ERROR_MR_INV_IVCOUNT 
 +  * 321 ERROR_MR_UN_PERFORM 
 + 
 +===== Remarks ===== 
 If IvCount is greater than 9, DosGetMessage returns an error that indicates IvCount is out of range. If the numeric value of x in the %x sequence for %1through%9 is less than or equal to IvCount, text insertion by substitution for %x, is performed for all occurrences of %x in the message. Otherwise text insertion is ignored and the %x sequence is returned in the message unchanged. Text insertion is performed for all text strings defined by IvCount and IvTable. If IvCount is greater than 9, DosGetMessage returns an error that indicates IvCount is out of range. If the numeric value of x in the %x sequence for %1through%9 is less than or equal to IvCount, text insertion by substitution for %x, is performed for all occurrences of %x in the message. Otherwise text insertion is ignored and the %x sequence is returned in the message unchanged. Text insertion is performed for all text strings defined by IvCount and IvTable.
  
Line 35: Line 46:
  
 The following is an example of a sample error message returned with the message ID: The following is an example of a sample error message returned with the message ID:
- SYS0100: File not found+ 
 +  SYS0100: File not found
  
 DosGetMessage retrieves messages previously prepared by the utility MKMSGF to create a message file, or MSGBIND to bind a message segment to an .EXE file. DosGetMessage tries to retrieve the message from RAM in the message segment bound to the .EXE program. If the message cannot be found, DosGetMessage retrieves the message from the message file on DASD (direct access storage device, such as a diskette or fixed-disk). DosGetMessage retrieves messages previously prepared by the utility MKMSGF to create a message file, or MSGBIND to bind a message segment to an .EXE file. DosGetMessage tries to retrieve the message from RAM in the message segment bound to the .EXE program. If the message cannot be found, DosGetMessage retrieves the message from the message file on DASD (direct access storage device, such as a diskette or fixed-disk).
  
 If the file name is not a fully-qualified name, DosGetMessage searches the following directories for default drive and path: If the file name is not a fully-qualified name, DosGetMessage searches the following directories for default drive and path:
-* The system root directory  + 
-* The current working directory  +  * The system root directory  
-* Directories listed in the DPATH statement (OS/2 mode only) +  * The current working directory  
-* Directories listed in the APPEND statement (DOS mode only). +  * Directories listed in the DPATH statement (OS/2 mode only) 
 +  * Directories listed in the APPEND statement (DOS mode only). 
  
 If a message cannot be retrieved because of a DASD error or file not found condition, a default message is placed in the user's buffer area. A message is placed in the buffer area based on the following error conditions: If a message cannot be retrieved because of a DASD error or file not found condition, a default message is placed in the user's buffer area. A message is placed in the buffer area based on the following error conditions:
-* The message number cannot be found in the message file. +  * The message number cannot be found in the message file. 
-* The message file cannot be found. +  * The message file cannot be found. 
-* The system detected a disk error trying to access the message file, or the message file format is incorrect. o +  * The system detected a disk error trying to access the message file, or the message file format is incorrect. o 
-* IvCount is out of range. +  * IvCount is out of range. 
-* A system error occurred trying to allocate storage. +  * A system error occurred trying to allocate storage. 
  
 When these conditions occur, the default message allows the application program to issue a message and prompt that enables recovery opportunity. When these conditions occur, the default message allows the application program to issue a message and prompt that enables recovery opportunity.
Line 58: Line 71:
 In order for DosGetMessage to be properly resolved, an application must be linked with DOSCALLS.LIB. In order for DosGetMessage to be properly resolved, an application must be linked with DOSCALLS.LIB.
  
-==Family API Considerations==+==== Family API Considerations ==== 
 Some options operate differently in the DOS mode than in OS/2 mode. Therefore, the following restriction applies to DosGetMessage when coding for the DOS mode: Some options operate differently in the DOS mode than in OS/2 mode. Therefore, the following restriction applies to DosGetMessage when coding for the DOS mode:
  
 If the message file name is not a fully qualified name, DosGetMessage searches the root directory of the default drive for the message file, instead of the root directory of the startup drive.  If the message file name is not a fully qualified name, DosGetMessage searches the root directory of the default drive for the message file, instead of the root directory of the startup drive. 
  
-==C Bindigns==+===== Bindings ===== 
 + 
 +==== C Bindigns ==== 
 +<code c>
  #define INCL_DOSMISC  #define INCL_DOSMISC
    
Line 78: Line 95:
    
  USHORT           rc;            /* return code */  USHORT           rc;            /* return code */
 +</code>
  
-==MASM Bidings==+==== MASM Bidings ==== 
 +<code asm>
  EXTRN  DosGetMessage:FAR  EXTRN  DosGetMessage:FAR
  INCL_DOSMISC      EQU 1    INCL_DOSMISC      EQU 1  
Line 91: Line 110:
  PUSH@  WORD    MsgLength     ;Length of message (returned)  PUSH@  WORD    MsgLength     ;Length of message (returned)
  CALL   DosGetMessage  CALL   DosGetMessage
- +</code> 
  Returns WORD  Returns WORD
  
- +===== Note =====
- +
-====== Note ======+
  
 Text based on [[http://www.edm2.com/index.php/DosGetMessage]] Text based on [[http://www.edm2.com/index.php/DosGetMessage]]