Changeset 342 for trunk/dll/instant.c
- Timestamp:
- Jul 26, 2006, 4:00:11 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/instant.c
r123 r342 4 4 $Id$ 5 5 6 Instant command 7 6 8 Copyright (c) 1993-98 M. Kimes 7 Copyright (c) 2004 Steven H.Levine 8 9 Revisions 01 Aug 04 SHL - Rework lstrip/rstrip usage 9 Copyright (c) 2004, 2006 Steven H.Levine 10 11 01 Aug 04 SHL Rework lstrip/rstrip usage 12 14 Jul 06 SHL Use Runtime_Error 10 13 11 14 ***********************************************************************/ … … 13 16 #define INCL_DOS 14 17 #define INCL_WIN 15 16 18 #include <os2.h> 19 17 20 #include <stdlib.h> 18 21 #include <stdio.h> 19 22 #include <string.h> 20 23 #include <ctype.h> 24 21 25 #include "fm3dll.h" 22 26 #include "fm3dlg.h" … … 25 29 26 30 #pragma data_seg(DATA1) 31 32 static PSZ pszSrcFile = __FILE__; 33 27 34 #pragma alloc_text(INSTANT,InstantDlgProc) 28 35 … … 31 38 static INT batches = 0; 32 39 33 34 MRESULT EXPENTRY InstantDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) { 35 40 MRESULT EXPENTRY InstantDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 41 { 36 42 CHAR *path; 37 APIRET temp;43 APIRET rc; 38 44 static CHAR *bat = NULL; 39 45 static HWND myhwnd = (HWND)0; … … 41 47 switch(msg) { 42 48 case WM_INITDLG: 43 if (myhwnd) {44 DosBeep(250,100);49 if (myhwnd) { 50 Runtime_Error(pszSrcFile, __LINE__, "busy"); 45 51 WinSendMsg(myhwnd,WM_SYSCOMMAND,MPFROM2SHORT(SC_RESTORE,0),MPVOID); 46 52 WinSetActiveWindow(HWND_DESKTOP,myhwnd); … … 48 54 break; 49 55 } 50 if (!mp2) {51 DosBeep(50,100);56 if (!mp2) { 57 Runtime_Error(pszSrcFile, __LINE__, "no data"); 52 58 WinDismissDlg(hwnd,0); 53 59 break; … … 98 104 mem = MLEgetlen(hwndMLE); 99 105 if(mem) { 100 if(DosAllocMem((PVOID)&bat,mem,101 PAG_COMMIT | PAG_READ | PAG_WRITE) ||102 103 Dos Beep(50,100);106 rc = DosAllocMem((PVOID)&bat,mem, 107 PAG_COMMIT | PAG_READ | PAG_WRITE); 108 if(rc || !bat) { 109 Dos_Error(MB_CANCEL,rc,HWND_DESKTOP,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY)); 104 110 WinDismissDlg(hwnd,0); 105 111 break; 106 112 } 107 113 tlen = (LONG)WinSendMsg(hwndMLE,MLM_QUERYTEXTLENGTH,MPVOID,MPVOID); 108 if(tlen) { 114 if(!tlen) 115 Runtime_Error(pszSrcFile, __LINE__, "no data"); 116 else { 109 117 WinSendMsg(hwndMLE,MLM_SETIMPORTEXPORT, 110 118 MPFROMP(bat), … … 123 131 rstrip(bat); 124 132 } 125 if(*bat) { 133 if(!*bat) 134 Runtime_Error(pszSrcFile, __LINE__, "no data"); 135 else { 126 136 sprintf(s,"%s%sFMTMP%d.CMD",path, 127 137 (path[strlen(path) - 1] == '\\') ? "" : "\\", 128 138 batches++); 129 139 fp = fopen(s,"w"); 130 if(fp) { 140 if(!fp) 141 Runtime_Error(pszSrcFile, __LINE__, "fopen"); 142 else { 131 143 if(!strncmp(bat,"/*",2)) { 132 144 rexx = "'"; … … 149 161 s); 150 162 } 151 else152 DosBeep(500,100);153 163 } 154 else155 DosBeep(50,100);156 164 } 157 else158 DosBeep(50,100);159 165 } 160 166 } … … 168 174 case IDM_HELP: 169 175 path = WinQueryWindowPtr(hwnd,0); 170 temp= saymsg(MB_YESNOCANCEL,176 rc = saymsg(MB_YESNOCANCEL, 171 177 hwnd, 172 178 GetPString(IDS_INSTANTHELPTITLETEXT), … … 175 181 (path[strlen(path) - 1] == '\\') ? "" : "\\", 176 182 batches); 177 if( temp== MBID_YES)183 if(rc == MBID_YES) 178 184 runemf2(WINDOWED | INVISIBLE | BACKGROUND, 179 185 hwnd, … … 182 188 "%s /C HELP BATCH", 183 189 GetCmdSpec(FALSE)); 184 else if( temp== MBID_CANCEL)190 else if(rc == MBID_CANCEL) 185 191 WinDismissDlg(hwnd,0); 186 192 break;
Note:
See TracChangeset
for help on using the changeset viewer.