Ignore:
Timestamp:
Jul 13, 2017, 5:17:57 AM (8 years ago)
Author:
stevenhl
Message:

Import modifications from cwmm-0_2_9-work-01_10_2006.zip dated 2006-08-27

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/common_functions/message.c

    r2 r4  
    44#include <os2.h>
    55#include <stdio.h>
     6#include <stdlib.h>
    67#include <string.h>
    78
     
    4445/* ULONG ulResult                                   */
    4546/*                                                  */
    46 /* MBID_ERROR is case of an error.                  */
     47/* MBID_ERROR in case of an error.                  */
    4748/* :p.                                              */
    4849/* Result code from WinMessageBox().                */
     
    8283}
    8384
     85#if 0
    8486/*!**************************************************/
    8587/*                                                  */
     
    8991/* the resource DLL or the EXE file.                */
    9092/* Unlike messagebox no buffers must be given but   */
    91 /* only the string IDs. MAx title length is 100,    */
     93/* only the string IDs. Max title length is 256,    */
    9294/* max text length 256.                             */
     95/* :p.                                              */
     96/*                                                  */
     97/* This function is obsolete.                       */
     98/* Use MsgShowMessageBox() instead.                 */
    9399/*                                                  */
    94100/* @@RETURNS                                        */
     
    96102/* ULONG ulResult                                   */
    97103/*                                                  */
    98 /* MBID_ERROR is case of an error.                  */
     104/* MBID_ERROR in case of an error.                  */
    99105/* :p.                                              */
    100106/* Result code from WinMessageBox().                */
    101107/*                                                  */
     108/* @@REMARKS                                        */
     109/*                                                  */
     110/* This function is obsolete.                       */
     111/* Use MsgShowMessageBox() instead.                 */
    102112/*                                                  */
    103113/*!!*************************************************/
     
    105115{
    106116  char text[256];
    107   char title[100];
     117  char title[256];
    108118
    109119  return mBox(  text, ulIDText , sizeof(text),
     
    111121               hModule, hwnd, ulFlag);
    112122};
     123#endif
     124
     125/*!**************************************************/
     126/*                                                  */
     127/* @@DESC                                           */
     128/*                                                  */
     129/* Show a message box with text strings loaded from */
     130/* the resource DLL or the EXE file.                */
     131/* Unlike messagebox() no buffers must be given but */
     132/* only the string IDs. Max title length is 256,    */
     133/* max text length 256.                             */
     134/*                                                  */
     135/* @@PARAM                                          */
     136/*                                                  */
     137/* HWND hwnd input                                  */
     138/*                                                  */
     139/* Handle to a window. This will be the owner of    */
     140/* the message box.                                 */
     141/*                                                  */
     142/* @@PARAM                                          */
     143/*                                                  */
     144/* ULONG ulIDTitle input                            */
     145/*                                                  */
     146/* ID of the string to be used as the title.        */
     147/*                                                  */
     148/* @@PARAM                                          */
     149/*                                                  */
     150/* ULONG ulIDText input                             */
     151/*                                                  */
     152/* ID of the string to be used as the text.         */
     153/*                                                  */
     154/* @@PARAM                                          */
     155/*                                                  */
     156/* HMODULE hModule input                            */
     157/*                                                  */
     158/* Handle to a ressource DLL or NULLHANDLE. If      */
     159/* this parameter is null the strings will be       */
     160/* taken from ressources bound to the executable.   */
     161/*                                                  */
     162/* @@PARAM                                          */
     163/*                                                  */
     164/* ULONG ulFlags input                              */
     165/*                                                  */
     166/* Flags specifying the appearance of the message   */
     167/* box. See WinMessageBox() for more information.   */
     168/*                                                  */
     169/* @@RETURNS                                        */
     170/*                                                  */
     171/* ULONG ulResult                                   */
     172/*                                                  */
     173/* MBID_ERROR in case of an error. This may be      */
     174/* for example if the ressources can't be found.    */
     175/* :p.                                              */
     176/* Result code from WinMessageBox().                */
     177/*                                                  */
     178/* @@REMARKS                                        */
     179/*                                                  */
     180/* The parent of the message box is HWND_DESKTOP.   */
     181/*                                                  */
     182/*!!*************************************************/
     183ULONG MsgShowMessageBox(HWND hwnd, ULONG ulIDTitle, ULONG ulIDText, HMODULE hModule, ULONG ulFlag)
     184{
     185  char* pText;
     186  char* pTitle;
     187  ULONG rc;
     188
     189#define TLENGTH 256L
     190
     191  if(NULLHANDLE==(pText=malloc(TLENGTH*2*sizeof(char))))
     192    return MBID_ERROR;
     193
     194  pTitle=pText+TLENGTH*sizeof(char);
     195
     196  rc=mBox( pText, ulIDText , TLENGTH,
     197           pTitle, ulIDTitle, TLENGTH,
     198           hModule, hwnd, ulFlag);
     199
     200  free(pText);
     201  return rc;
     202};
     203
    113204
    114205/*!**************************************************/
     
    125216/* TRUE if string was found in the resource DLL or  */
    126217/* EXE file. FALSE otherwise.                       */
     218/*                                                  */
     219/* @@REMARKS                                        */
     220/*                                                  */
     221/* This function is obsolete.                       */
     222/* Use MsgGetMessage() instead.                     */
    127223/*                                                  */
    128224/*!!*************************************************/
     
    136232}
    137233
     234/*!***********************************************************/
     235/*                                                           */
     236/* Load a message string from a resource DLL or the          */
     237/* EXE file.                                                 */
     238/*                                                           */
     239/* @@RETURNS                                                 */
     240/*                                                           */
     241/* BOOL rc                                                   */
     242/*                                                           */
     243/* TRUE if string was found in the resource DLL or           */
     244/* EXE file. FALSE otherwise.                                */
     245/*                                                           */
     246/* @@REMARKS                                                 */
     247/*                                                           */
     248/* If an error occurs an empty string is placed in the       */
     249/* buffer.                                                   */
     250/*                                                           */
     251/*!!**********************************************************/
    138252BOOL MsgGetMessage(char* text,ULONG ulID, LONG lSizeText, HMODULE hResource,HWND hwnd)
    139253{
Note: See TracChangeset for help on using the changeset viewer.