Changeset 342 for trunk/dll/instant.c


Ignore:
Timestamp:
Jul 26, 2006, 4:00:11 AM (19 years ago)
Author:
root
Message:

Use Runtime_Error

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/instant.c

    r123 r342  
    44  $Id$
    55
     6  Instant command
     7
    68  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
    1013
    1114***********************************************************************/
     
    1316#define INCL_DOS
    1417#define INCL_WIN
    15 
    1618#include <os2.h>
     19
    1720#include <stdlib.h>
    1821#include <stdio.h>
    1922#include <string.h>
    2023#include <ctype.h>
     24
    2125#include "fm3dll.h"
    2226#include "fm3dlg.h"
     
    2529
    2630#pragma data_seg(DATA1)
     31
     32static PSZ pszSrcFile = __FILE__;
     33
    2734#pragma alloc_text(INSTANT,InstantDlgProc)
    2835
     
    3138static INT batches = 0;
    3239
    33 
    34 MRESULT EXPENTRY InstantDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
    35 
     40MRESULT EXPENTRY InstantDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)
     41{
    3642  CHAR  *path;
    37   APIRET temp;
     43  APIRET rc;
    3844  static CHAR *bat = NULL;
    3945  static HWND  myhwnd = (HWND)0;
     
    4147  switch(msg) {
    4248    case WM_INITDLG:
    43       if(myhwnd) {
    44         DosBeep(250,100);
     49      if (myhwnd) {
     50        Runtime_Error(pszSrcFile, __LINE__, "busy");
    4551        WinSendMsg(myhwnd,WM_SYSCOMMAND,MPFROM2SHORT(SC_RESTORE,0),MPVOID);
    4652        WinSetActiveWindow(HWND_DESKTOP,myhwnd);
     
    4854        break;
    4955      }
    50       if(!mp2) {
    51         DosBeep(50,100);
     56      if (!mp2) {
     57        Runtime_Error(pszSrcFile, __LINE__, "no data");
    5258        WinDismissDlg(hwnd,0);
    5359        break;
     
    98104            mem = MLEgetlen(hwndMLE);
    99105            if(mem) {
    100               if(DosAllocMem((PVOID)&bat,mem,
    101                                PAG_COMMIT | PAG_READ | PAG_WRITE) ||
    102                 !bat) {
    103                 DosBeep(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));
    104110                WinDismissDlg(hwnd,0);
    105111                break;
    106112              }
    107113              tlen = (LONG)WinSendMsg(hwndMLE,MLM_QUERYTEXTLENGTH,MPVOID,MPVOID);
    108               if(tlen) {
     114              if(!tlen)
     115                Runtime_Error(pszSrcFile, __LINE__, "no data");
     116              else {
    109117                WinSendMsg(hwndMLE,MLM_SETIMPORTEXPORT,
    110118                           MPFROMP(bat),
     
    123131                  rstrip(bat);
    124132                }
    125                 if(*bat) {
     133                if(!*bat)
     134                  Runtime_Error(pszSrcFile, __LINE__, "no data");
     135                else {
    126136                  sprintf(s,"%s%sFMTMP%d.CMD",path,
    127137                          (path[strlen(path) - 1] == '\\') ? "" : "\\",
    128138                          batches++);
    129139                  fp = fopen(s,"w");
    130                   if(fp) {
     140                  if(!fp)
     141                    Runtime_Error(pszSrcFile, __LINE__, "fopen");
     142                  else {
    131143                    if(!strncmp(bat,"/*",2)) {
    132144                      rexx = "'";
     
    149161                            s);
    150162                  }
    151                   else
    152                     DosBeep(500,100);
    153163                }
    154                 else
    155                   DosBeep(50,100);
    156164              }
    157               else
    158                 DosBeep(50,100);
    159165            }
    160166          }
     
    168174        case IDM_HELP:
    169175          path = WinQueryWindowPtr(hwnd,0);
    170           temp = saymsg(MB_YESNOCANCEL,
     176          rc = saymsg(MB_YESNOCANCEL,
    171177                        hwnd,
    172178                        GetPString(IDS_INSTANTHELPTITLETEXT),
     
    175181                        (path[strlen(path) - 1] == '\\') ? "" : "\\",
    176182                        batches);
    177           if(temp ==  MBID_YES)
     183          if(rc ==  MBID_YES)
    178184            runemf2(WINDOWED | INVISIBLE | BACKGROUND,
    179185                    hwnd,
     
    182188                    "%s /C HELP BATCH",
    183189                    GetCmdSpec(FALSE));
    184           else if(temp == MBID_CANCEL)
     190          else if(rc == MBID_CANCEL)
    185191            WinDismissDlg(hwnd,0);
    186192          break;
Note: See TracChangeset for help on using the changeset viewer.