Changeset 4 for trunk/common_functions/message.c
- Timestamp:
- Jul 13, 2017, 5:17:57 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/common_functions/message.c
r2 r4 4 4 #include <os2.h> 5 5 #include <stdio.h> 6 #include <stdlib.h> 6 7 #include <string.h> 7 8 … … 44 45 /* ULONG ulResult */ 45 46 /* */ 46 /* MBID_ERROR i scase of an error. */47 /* MBID_ERROR in case of an error. */ 47 48 /* :p. */ 48 49 /* Result code from WinMessageBox(). */ … … 82 83 } 83 84 85 #if 0 84 86 /*!**************************************************/ 85 87 /* */ … … 89 91 /* the resource DLL or the EXE file. */ 90 92 /* Unlike messagebox no buffers must be given but */ 91 /* only the string IDs. M Ax title length is 100, */93 /* only the string IDs. Max title length is 256, */ 92 94 /* max text length 256. */ 95 /* :p. */ 96 /* */ 97 /* This function is obsolete. */ 98 /* Use MsgShowMessageBox() instead. */ 93 99 /* */ 94 100 /* @@RETURNS */ … … 96 102 /* ULONG ulResult */ 97 103 /* */ 98 /* MBID_ERROR i scase of an error. */104 /* MBID_ERROR in case of an error. */ 99 105 /* :p. */ 100 106 /* Result code from WinMessageBox(). */ 101 107 /* */ 108 /* @@REMARKS */ 109 /* */ 110 /* This function is obsolete. */ 111 /* Use MsgShowMessageBox() instead. */ 102 112 /* */ 103 113 /*!!*************************************************/ … … 105 115 { 106 116 char text[256]; 107 char title[ 100];117 char title[256]; 108 118 109 119 return mBox( text, ulIDText , sizeof(text), … … 111 121 hModule, hwnd, ulFlag); 112 122 }; 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 /*!!*************************************************/ 183 ULONG 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 113 204 114 205 /*!**************************************************/ … … 125 216 /* TRUE if string was found in the resource DLL or */ 126 217 /* EXE file. FALSE otherwise. */ 218 /* */ 219 /* @@REMARKS */ 220 /* */ 221 /* This function is obsolete. */ 222 /* Use MsgGetMessage() instead. */ 127 223 /* */ 128 224 /*!!*************************************************/ … … 136 232 } 137 233 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 /*!!**********************************************************/ 138 252 BOOL MsgGetMessage(char* text,ULONG ulID, LONG lSizeText, HMODULE hResource,HWND hwnd) 139 253 {
Note:
See TracChangeset
for help on using the changeset viewer.