Changeset 356 for trunk/dll/notify.c


Ignore:
Timestamp:
Jul 26, 2006, 9:58:37 PM (19 years ago)
Author:
root
Message:

Check more run time errors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/notify.c

    r2 r356  
     1
     2/***********************************************************************
     3
     4  $Id$
     5
     6  Notifications
     7
     8  Copyright (c) 1993-98 M. Kimes
     9  Copyright (c) 2006 Steven H.Levine
     10
     11  17 Jul 06 SHL Use Win_Error
     12  22 Jul 06 SHL Check more run time errors
     13
     14***********************************************************************/
     15
    116#define INCL_DOS
    217#define INCL_WIN
    318#define INCL_GPI
    4 
    519#include <os2.h>
     20
    621#include <stdarg.h>
    722#include <stdio.h>
     
    1126#include <time.h>
    1227#include <stddef.h>
     28
    1329#include "fm3dll.h"
    1430#include "fm3dlg.h"
     
    1632
    1733#pragma data_seg(DATA1)
     34
     35static PSZ pszSrcFile = __FILE__;
     36
    1837#pragma alloc_text(NOTIFY,Notify,NotifyWndProc,StartNotify)
    1938#pragma alloc_text(NOTIFY,NotifyThread,NotifyError)
     
    2342static HWND hwndNotify;
    2443
    25 
    26 MRESULT EXPENTRY NotifyWndProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
    27 
     44MRESULT EXPENTRY NotifyWndProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)
     45{
    2846  static ULONG showing = 0;
    2947
     
    3957                          ID_TIMER2,
    4058                          5000)) {
    41           DosBeep(50,100);
     59          Win_Error(hwnd,hwnd,pszSrcFile,__LINE__,"WinStartTimer");
    4260          WinDestroyWindow(hwnd);
    4361        }
     
    125143
    126144
    127 HWND DoNotify (char *str) {
    128 
     145HWND DoNotify (char *str)
     146{
    129147  char          *p;
    130148  HWND          hwnd = (HWND)0,hwndP;
     
    157175    /* pretty-up the note by putting on a leading space */
    158176    if(*str != ' ') {
    159       p = malloc(strlen(str) + 2);
     177      p = xmalloc(strlen(str) + 2,pszSrcFile,__LINE__);
    160178      if(!p)
    161179        p = str;
     
    193211
    194212
    195 HWND Notify (char *str) {
    196 
     213HWND Notify (char *str)
     214{
    197215  return (HWND)WinSendMsg(MainObjectHwnd,UM_NOTIFY,MPFROMP(str),MPVOID);
    198216}
    199217
    200218
    201 VOID NotifyError (CHAR *filename,APIRET status) {
    202 
     219VOID NotifyError (CHAR *filename,APIRET status)
     220{
    203221  CHAR errortext[512];
    204222
     
    241259
    242260
    243 MRESULT EXPENTRY NoteWndProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
    244 
     261MRESULT EXPENTRY NoteWndProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)
     262{
    245263  static HPOINTER hptrIcon = (HPOINTER)0;
    246264
     
    459477
    460478
    461 VOID NoteThread (VOID *args) {
    462 
     479VOID NoteThread (VOID *args)
     480{
    463481  HAB    hab2;
    464482  HMQ    hmq2;
     
    482500
    483501
    484 BOOL StartNotes (CHAR *note) {
    485 
    486   if(!hwndNotify) {
    487     if(_beginthread(NoteThread,
    488                     NULL,
    489                     65536,
    490                     (PVOID)note) != -1)
    491       return TRUE;
    492   }
    493   else
    494     return TRUE;
    495   return FALSE;
    496 }
    497 
    498 
    499 BOOL AddNote (CHAR *note) {
    500 
     502VOID StartNotes (CHAR *note)
     503{
     504  if (!hwndNotify) {
     505    if (_beginthread(NoteThread,NULL,65536,(PVOID)note) == -1)
     506      Runtime_Error(pszSrcFile, __LINE__, GetPString(IDS_COULDNTSTARTTHREADTEXT));
     507  }
     508}
     509
     510
     511BOOL AddNote (CHAR *note)
     512{
    501513  CHAR *s,*p;
    502514  BOOL  once = FALSE,ret = FALSE;
     
    549561
    550562
    551 VOID EndNote (VOID) {
    552 
     563VOID EndNote (VOID)
     564{
    553565  if(hwndNotify)
    554566    if(!PostMsg(hwndNotify,
     
    563575
    564576
    565 VOID ShowNote (VOID) {
    566 
     577VOID ShowNote (VOID)
     578{
    567579  if(!hwndNotify)
    568580    StartNotes(NULL);
     
    581593
    582594
    583 VOID HideNote (VOID) {
    584 
     595VOID HideNote (VOID)
     596{
    585597  if(hwndNotify)
    586598    WinSetWindowPos(hwndNotify,
Note: See TracChangeset for help on using the changeset viewer.