| 1 | /* | 
|---|
| 2 | * This file is (C) Chris Wohlgemuth 1999-2004 | 
|---|
| 3 | */ | 
|---|
| 4 | /* | 
|---|
| 5 | * This program is free software; you can redistribute it and/or modify | 
|---|
| 6 | * it under the terms of the GNU General Public License as published by | 
|---|
| 7 | * the Free Software Foundation; either version 2, or (at your option) | 
|---|
| 8 | * any later version. | 
|---|
| 9 | * | 
|---|
| 10 | * This program is distributed in the hope that it will be useful, | 
|---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 13 | * GNU General Public License for more details. | 
|---|
| 14 | * | 
|---|
| 15 | * You should have received a copy of the GNU General Public License | 
|---|
| 16 | * along with this program; see the file COPYING.  If not, write to | 
|---|
| 17 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | 
|---|
| 18 | */ | 
|---|
| 19 |  | 
|---|
| 20 | #define INCL_WIN | 
|---|
| 21 |  | 
|---|
| 22 | #include <os2.h> | 
|---|
| 23 | #include <stdio.h> | 
|---|
| 24 | #include <string.h> | 
|---|
| 25 |  | 
|---|
| 26 | #define DEBUG | 
|---|
| 27 |  | 
|---|
| 28 | void errorResource2(char * chrTitle); | 
|---|
| 29 |  | 
|---|
| 30 |  | 
|---|
| 31 | void errorResource() | 
|---|
| 32 | { | 
|---|
| 33 | /* | 
|---|
| 34 | Don't show a message box because on WPS startup this may lead to a deadlock. | 
|---|
| 35 | At least I suspect this happens on system where the MM classes don't work. | 
|---|
| 36 | Instead there's a new function errorResourceVerbose() which may be called when we | 
|---|
| 37 | know, the WPS is up and running. | 
|---|
| 38 | */ | 
|---|
| 39 |  | 
|---|
| 40 | errorResource2("Problem with Media-Folder installation"); | 
|---|
| 41 |  | 
|---|
| 42 | } | 
|---|
| 43 |  | 
|---|
| 44 | void errorResource2(char * chrTitle) | 
|---|
| 45 | { | 
|---|
| 46 | /* | 
|---|
| 47 | Don't show a message box because on WPS startup this may lead to a deadlock. | 
|---|
| 48 | At least I suspect this happens on system where the MM classes don't work. | 
|---|
| 49 | Instead there's a new function errorResourceVerbose() which may be called when we | 
|---|
| 50 | know, the WPS is up and running. | 
|---|
| 51 | */ | 
|---|
| 52 | } | 
|---|
| 53 |  | 
|---|
| 54 | void errorResourceVerbose(char * chrTitle) | 
|---|
| 55 | { | 
|---|
| 56 | #ifdef ECS | 
|---|
| 57 | WinMessageBox(HWND_DESKTOP,0, | 
|---|
| 58 | "The resource DLL which contains all the dialogs, graphics and messages cannot be loaded. \ | 
|---|
| 59 | Please check your installation. There must be a file MFLDR_xx.DLL in the .\\MMOS2\\MEDIAFLD\\BIN directory of the \ | 
|---|
| 60 | Media-Player package. xx is the language code of your system e.g. DE for Germany. This code is taken from the \ | 
|---|
| 61 | SET LANG=xx_XX environment variable in your config.sys. If there is no \ | 
|---|
| 62 | support for your language there must be at least the file MFLDR_EN.DLL. The Media-Player features \ | 
|---|
| 63 | are not available!", | 
|---|
| 64 | chrTitle,12345, | 
|---|
| 65 | MB_OK|MB_MOVEABLE|MB_ERROR); | 
|---|
| 66 | #else | 
|---|
| 67 | WinMessageBox(HWND_DESKTOP,0, | 
|---|
| 68 | "The resource DLL which contains all the dialogs, graphics and messages cannot be loaded. \ | 
|---|
| 69 | Please check your installation. There must be a file MFLDR_xx.DLL in the BIN directory of the \ | 
|---|
| 70 | Media-Player package. xx is the language code of your system e.g. DE for Germany. This code is taken from the \ | 
|---|
| 71 | SET LANG=xx_XX environment variable in your config.sys. If there is no \ | 
|---|
| 72 | support for your language there must be at least the file MFLDR_EN.DLL. The Media-Player features \ | 
|---|
| 73 | are not available!", | 
|---|
| 74 | chrTitle,12345, | 
|---|
| 75 | MB_OK|MB_MOVEABLE|MB_ERROR); | 
|---|
| 76 | #endif | 
|---|
| 77 | } | 
|---|
| 78 |  | 
|---|
| 79 | ULONG messageBox( char* text, ULONG ulTextID , LONG lSizeText, | 
|---|
| 80 | char* title, ULONG ulTitleID, LONG lSizeTitle, | 
|---|
| 81 | HMODULE hResource, HWND hwnd, ULONG ulFlags) | 
|---|
| 82 | { | 
|---|
| 83 |  | 
|---|
| 84 | if(!WinLoadString(WinQueryAnchorBlock(hwnd),hResource,ulTextID,lSizeText,text)) { | 
|---|
| 85 | errorResource(); | 
|---|
| 86 | return MBID_ERROR; | 
|---|
| 87 | } | 
|---|
| 88 | if(!WinLoadString(WinQueryAnchorBlock(hwnd),hResource,ulTitleID,lSizeTitle,title)) { | 
|---|
| 89 | errorResource(); | 
|---|
| 90 | return MBID_ERROR; | 
|---|
| 91 | } | 
|---|
| 92 | return WinMessageBox(  HWND_DESKTOP, hwnd, text, title, 0UL, ulFlags ); | 
|---|
| 93 | } | 
|---|
| 94 |  | 
|---|
| 95 | BOOL getMessage(char* text,ULONG ulID, LONG lSizeText, HMODULE hResource,HWND hwnd) | 
|---|
| 96 | { | 
|---|
| 97 | if(!WinLoadString(WinQueryAnchorBlock(hwnd),hResource,ulID,lSizeText,text)) { | 
|---|
| 98 | sprintf(text,""); | 
|---|
| 99 | return FALSE; | 
|---|
| 100 | } | 
|---|
| 101 | return TRUE; | 
|---|
| 102 | } | 
|---|
| 103 |  | 
|---|
| 104 |  | 
|---|
| 105 |  | 
|---|