| 1 |
|
|---|
| 2 | #define INCL_WIN
|
|---|
| 3 |
|
|---|
| 4 | #include <os2.h>
|
|---|
| 5 | #include <stdio.h>
|
|---|
| 6 | #include <string.h>
|
|---|
| 7 |
|
|---|
| 8 | void errorResourceVerbose(void)
|
|---|
| 9 | {
|
|---|
| 10 | WinMessageBox(HWND_DESKTOP,0,
|
|---|
| 11 | "The resource DLL which contains all the dialogs, graphics and messages cannot be loaded. \
|
|---|
| 12 | Please check your installation.",
|
|---|
| 13 | "Problem with class installation",12345,
|
|---|
| 14 | MB_OK|MB_MOVEABLE|MB_ERROR);
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | void errorResource(void)
|
|---|
| 18 | {
|
|---|
| 19 | #if 0
|
|---|
| 20 | /*
|
|---|
| 21 | Don't show a message box because on WPS startup this may lead to a deadlock.
|
|---|
| 22 | At least I suspect this happens on system where the MM classes don't work.
|
|---|
| 23 | Instead there's a new function errorResourceVerbose() which may be called when we
|
|---|
| 24 | know, the WPS is up and running.
|
|---|
| 25 | */
|
|---|
| 26 | WinMessageBox(HWND_DESKTOP,0,
|
|---|
| 27 | "The resource DLL which contains all the dialogs, graphics and messages cannot be loaded. \
|
|---|
| 28 | Please check your installation.",
|
|---|
| 29 | "Problem with class installation",12345,
|
|---|
| 30 | MB_OK|MB_MOVEABLE|MB_ERROR);
|
|---|
| 31 | #endif
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 | /*!**************************************************/
|
|---|
| 36 | /* */
|
|---|
| 37 | /* @@DESC */
|
|---|
| 38 | /* */
|
|---|
| 39 | /* Show a message box with text strings loaded from */
|
|---|
| 40 | /* the resource DLL or the EXE file. */
|
|---|
| 41 | /* */
|
|---|
| 42 | /* @@RETURNS */
|
|---|
| 43 | /* */
|
|---|
| 44 | /* ULONG ulResult */
|
|---|
| 45 | /* */
|
|---|
| 46 | /* MBID_ERROR is case of an error. */
|
|---|
| 47 | /* :p. */
|
|---|
| 48 | /* Result code from WinMessageBox(). */
|
|---|
| 49 | /* */
|
|---|
| 50 | /* */
|
|---|
| 51 | /*!!*************************************************/
|
|---|
| 52 | ULONG messageBox( char* text, ULONG ulTextID , LONG lSizeText,
|
|---|
| 53 | char* title, ULONG ulTitleID, LONG lSizeTitle,
|
|---|
| 54 | HMODULE hResource, HWND hwnd, ULONG ulFlags)
|
|---|
| 55 | {
|
|---|
| 56 |
|
|---|
| 57 | if(!WinLoadString(WinQueryAnchorBlock(hwnd),hResource,ulTextID,lSizeText,text)) {
|
|---|
| 58 | errorResource();
|
|---|
| 59 | return MBID_ERROR;
|
|---|
| 60 | }
|
|---|
| 61 | if(!WinLoadString(WinQueryAnchorBlock(hwnd),hResource,ulTitleID,lSizeTitle,title)) {
|
|---|
| 62 | errorResource();
|
|---|
| 63 | return MBID_ERROR;
|
|---|
| 64 | }
|
|---|
| 65 | return WinMessageBox( hwnd, hwnd, text, title, 0UL, ulFlags );
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | static ULONG mBox( char* text, ULONG ulTextID , LONG lSizeText,
|
|---|
| 69 | char* title, ULONG ulTitleID, LONG lSizeTitle,
|
|---|
| 70 | HMODULE hResource, HWND hwnd, ULONG ulFlags)
|
|---|
| 71 | {
|
|---|
| 72 |
|
|---|
| 73 | if(!WinLoadString(WinQueryAnchorBlock(hwnd),hResource,ulTextID,lSizeText,text)) {
|
|---|
| 74 | errorResource();
|
|---|
| 75 | return MBID_ERROR;
|
|---|
| 76 | }
|
|---|
| 77 | if(!WinLoadString(WinQueryAnchorBlock(hwnd),hResource,ulTitleID,lSizeTitle,title)) {
|
|---|
| 78 | errorResource();
|
|---|
| 79 | return MBID_ERROR;
|
|---|
| 80 | }
|
|---|
| 81 | return WinMessageBox( HWND_DESKTOP, hwnd, text, title, 0UL, ulFlags );
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 | /*!**************************************************/
|
|---|
| 85 | /* */
|
|---|
| 86 | /* @@DESC */
|
|---|
| 87 | /* */
|
|---|
| 88 | /* Show a message box with text strings loaded from */
|
|---|
| 89 | /* the resource DLL or the EXE file. */
|
|---|
| 90 | /* Unlike messagebox no buffers must be given but */
|
|---|
| 91 | /* only the string IDs. MAx title length is 100, */
|
|---|
| 92 | /* max text length 256. */
|
|---|
| 93 | /* */
|
|---|
| 94 | /* @@RETURNS */
|
|---|
| 95 | /* */
|
|---|
| 96 | /* ULONG ulResult */
|
|---|
| 97 | /* */
|
|---|
| 98 | /* MBID_ERROR is case of an error. */
|
|---|
| 99 | /* :p. */
|
|---|
| 100 | /* Result code from WinMessageBox(). */
|
|---|
| 101 | /* */
|
|---|
| 102 | /* */
|
|---|
| 103 | /*!!*************************************************/
|
|---|
| 104 | ULONG showMessageBox2(HWND hwnd, ULONG ulIDTitle, ULONG ulIDText, HMODULE hModule, ULONG ulFlag)
|
|---|
| 105 | {
|
|---|
| 106 | char text[256];
|
|---|
| 107 | char title[100];
|
|---|
| 108 |
|
|---|
| 109 | return mBox( text, ulIDText , sizeof(text),
|
|---|
| 110 | title, ulIDTitle, sizeof(title),
|
|---|
| 111 | hModule, hwnd, ulFlag);
|
|---|
| 112 | };
|
|---|
| 113 |
|
|---|
| 114 | /*!**************************************************/
|
|---|
| 115 | /* */
|
|---|
| 116 | /* @@DESC */
|
|---|
| 117 | /* */
|
|---|
| 118 | /* Load a message string from a resource DLL or the */
|
|---|
| 119 | /* EXE file. */
|
|---|
| 120 | /* */
|
|---|
| 121 | /* @@RETURNS */
|
|---|
| 122 | /* */
|
|---|
| 123 | /* BOOL rc */
|
|---|
| 124 | /* */
|
|---|
| 125 | /* TRUE if string was found in the resource DLL or */
|
|---|
| 126 | /* EXE file. FALSE otherwise. */
|
|---|
| 127 | /* */
|
|---|
| 128 | /*!!*************************************************/
|
|---|
| 129 | BOOL getMessage(char* text,ULONG ulID, LONG lSizeText, HMODULE hResource,HWND hwnd)
|
|---|
| 130 | {
|
|---|
| 131 | if(!WinLoadString(WinQueryAnchorBlock(hwnd),hResource,ulID,lSizeText,text)) {
|
|---|
| 132 | strcpy(text,"");
|
|---|
| 133 | return FALSE;
|
|---|
| 134 | }
|
|---|
| 135 | return TRUE;
|
|---|
| 136 | }
|
|---|
| 137 |
|
|---|
| 138 | BOOL MsgGetMessage(char* text,ULONG ulID, LONG lSizeText, HMODULE hResource,HWND hwnd)
|
|---|
| 139 | {
|
|---|
| 140 | return getMessage( text, ulID, lSizeText, hResource, hwnd);
|
|---|
| 141 | }
|
|---|
| 142 |
|
|---|
| 143 | void pmUsage()
|
|---|
| 144 | {
|
|---|
| 145 | WinMessageBox(HWND_DESKTOP,0,
|
|---|
| 146 | "This helper shouldn't be started by hand. It is called by the multimedia classes. \
|
|---|
| 147 | If you didn't launch the helper by hand you may have found a bug. Please contact the author.",
|
|---|
| 148 | "Problem with multimedia classes",12345,
|
|---|
| 149 | MB_OK|MB_MOVEABLE|MB_ERROR);
|
|---|
| 150 |
|
|---|
| 151 | }
|
|---|
| 152 |
|
|---|