int main( void) { HAB hab = 0; HMQ hmq = 0; HWND hwnd = 0; int nRtn = 8; QMSG qmsg; do { Morph(); hab = WinInitialize( 0); if (!hab) break; hmq = WinCreateMsgQueue( hab, 0); if (!hmq) break; // avoid compatibility problems // RWSFULLVERSION for RwsTest v0.80 is 0x08000100 if (RwsQueryVersion( 0) < RWSFULLVERSION) { WinMessageBox( HWND_DESKTOP, 0, "Please use a newer version of the RWS08 dlls", "FPos", 1, MB_OK | MB_ERROR | MB_MOVEABLE); break; } hwnd = WinLoadDlg( HWND_DESKTOP, // parent-window NULLHANDLE, // owner-window MainWndProc, // dialog proc NULLHANDLE, // EXE module handle IDD_MAIN, // dialog id NULL); // pointer to create params if (!hwnd) break; while (WinGetMsg( hab, &qmsg, NULLHANDLE, 0, 0)) WinDispatchMsg( hab, &qmsg); nRtn = 0; } while (fFalse); if (nRtn) DosBeep( 440, 150); if (hwnd) WinDestroyWindow( hwnd); if (hmq) WinDestroyMsgQueue( hmq); if (hab) WinTerminate( hab); return (nRtn); }
// // Make Warning Beep If Option Is Enabled // void WarnBeep(void) { if(UserSetup.WarnBeep) { DosBeep(750,125); } }
VOID Krnl_Debug_Bzz( VOID ) { // Звук. DosBeep( 50, 50 ); // Возврат. return; }
void shutdown(HFILE com) { HAB hAnchorBlock; ULONG ulRetCode; ULONG ulSendResult; HMQ hMsgQWindow; QMSG rMsgQWin; QMSG rMsgDESK; int x; if ((hAnchorBlock = WinInitialize(0)) == NULLHANDLE) return; if ((hMsgQWindow = WinCreateMsgQueue(hAnchorBlock, 0)) == NULLHANDLE) return; rMsgDESK.hwnd = HWND_DESKTOP; rMsgDESK.msg = 0; rMsgDESK.mp1 = MPVOID; rMsgDESK.mp2 = MPVOID; rMsgDESK.time = 0; rMsgDESK.reserved = 0; ulSendResult = WinBroadcastMsg(HWND_DESKTOP, WM_SYSCOMMAND, MPFROMSHORT(SC_CLOSE), MPFROM2SHORT(CMDSRC_MENU,FALSE), (ULONG) BMSG_FRAMEONLY); for (int i=0; i < 60; i++) // One minute for a clean stop of all programs { x = CheckState(com); if (x != state) state = x; if (state == 0) { counter = COUNT_INIT; return; }; if (state == 2) break; DosSleep(1000); } DosBeep(4000, 100); DosBeep(3000, 100); DosBeep(2000, 100); DosBeep(1000, 100); DosShutdown(0); UPSPowerOff(com); WinDestroyMsgQueue(hMsgQWindow); WinTerminate(hAnchorBlock); return; }
/* -------------------------------------------------------------------------- Display a menu of choices, returning the ordinal (0 based) of the selected choice. - Parameters ------------------------------------------------------------- INT iRow : line position (0 = top of screen, -1 = current position). PSZ pszPrompt : prompt message. PSZ choices : array of choice characters (max 5 characters). PMENUFN pfunc : optional callback function used when the menu has a 'retry' item. When pfunc() returns FALSE the loop is terminated. PVOID pparm : optional pfunc() parameters. - Return value ----------------------------------------------------------- ULONG : number of the selected choice. - Note: ------------------------------------------------------------------ If pszPrompt is NULL the area where the prompt message is printed is cleared and no other action is performed. -------------------------------------------------------------------------- */ ULONG showMenu(PSZ pszPrompt, PSZ choices) { CHAR achscr[1760]; CHAR achmenu[1760]; CHAR buf[4]; ULONG key; USHORT row, col, irow, cb; PSZ pChoice, pLine, pEnd; buf[0] = ' '; buf[1] = VIOB_GRAY | VIOF_DARKBLUE; DosBeep(220, 50); DosBeep(440, 50); DosBeep(880, 50); cb = sizeof(achscr); VioReadCellStr(achscr, &cb, 7, 0, 0); VioScrollUp(7, 0, 17, 80, 11, buf, 0); sprintf(achmenu, pszPrompt, choices[0], choices[1], choices[2], choices[3], choices[4]); VioGetCurPos(&row, &col, 0); for (pLine = pEnd = achmenu, irow = 8; pEnd; ++irow) { if (NULL != (pEnd = strchr(pLine, '\r'))) { *pEnd = '\0'; if (*++pEnd == '\n') ++pEnd; } // skip empty lines if (*pLine) VioWrtCharStrAtt(pLine, strlen(pLine), irow, 0, buf + 1, 0); pLine = pEnd; } VioSetCurPos(irow, 0, 0); // VioWrtCharStrAtt(pszPrompt, strlen(pszPrompt), 8, 0, buf + 1, 0); for (;;) { key = kbdKeyChar(kbdKey()) & ~0x20; if (NULL != (pChoice = strchr(choices, (INT)key))) break; DosBeep(440, 100); } VioWrtCellStr(achscr, cb, 7, 0, 0); VioSetCurPos(row, col, 0); return (ULONG)(pChoice - choices); }
BOOL MenuSample::OCommand(ULONG msg, MPARAM mp1, MPARAM mp2) { switch(msg) { case WM_COMMAND: switch(SHORT1FROMMP(mp1)) { case MENU_MENU_QUIT: WinSendMsg(hwnd, WM_CLOSE, NULL, NULL); break; case MENU_CHECK: if (menu->isChecked(MENU_CHECK)) { menu->checkItem(MENU_CHECK, FALSE); menu->setItemText(MENU_CHECK, TEXT_UNCHECKED); } else { menu->checkItem(MENU_CHECK, TRUE); menu->setItemText(MENU_CHECK, TEXT_CHECKED); } break; case MENU_DISABLE: if (menu->isEnabled(MENU_DISABLE)) { menu->enableItem(MENU_DISABLE, FALSE); menu->setItemText(MENU_DISABLE, TEXT_DISABLED); } else { menu->enableItem(MENU_DISABLE, TRUE); menu->setItemText(MENU_DISABLE, TEXT_ENABLED); } break; default: DosBeep(100, 100); break; } break; case WM_CLOSE: WinPostMsg(hwnd, WM_QUIT, NULL, NULL); break; default: return(FALSE); } return(TRUE); #ifdef __BCPLUSPLUS__ #pragma warn -par #endif }
void LogEvent( char* format, ... ) { char* LogDir; va_list ap; FILE* f; if ( g_CheckedEnvironment ) { if ( g_LogFilePath == NULL ) /* logging is not enabled */ return; } else { /* check the environment var to see if logging is enabled */ g_CheckedEnvironment = 1; LogDir = getenv( LOG_DIR_VAR ); if ( LogDir == NULL ) /* not defined */ return; if ( strlen( LogDir ) == 0 ) /* defined as blank? */ return; /* allocate space for full path, plus slash, plus terminator */ g_LogFilePath = malloc( strlen( LogDir ) + strlen( LOG_FILENAME ) + 2 ); if ( g_LogFilePath == NULL ) /* out of memory */ return; /* copy path */ strcpy( g_LogFilePath, LogDir ); /* add ending slash if needed */ if ( g_LogFilePath[ strlen( g_LogFilePath ) - 1 ] != '\\' ) strcat( g_LogFilePath, "\\" ); /* add filename */ strcat( g_LogFilePath, LOG_FILENAME ); } f = fopen( g_LogFilePath, "a" ); if ( f == NULL ) { DosBeep( 2000, 50 ); printf( "fopen failed, errno %d: %s", errno, strerror( errno ) ); return; } va_start( ap, format ); vfprintf( f, format, ap ); fprintf( f, "\n" ); fclose( f ); va_end( ap ); }
void play_sound(int num) { if (strlen(sound[num].file)==0) return; if (!(pfnMciPlayFile) || (strcmp(sound[num].file,BEEP)==0)) { DosBeep(200,200); return; } if (isdigit((int)(*sound[num].file))) play_system_sound(sound[num].file); else { char buf[MAXSTR]; buf[0] = '\042'; strcpy(buf+1, sound[num].file); strcat(buf, "\042"); if ((*pfnMciPlayFile)(hwnd_frame, (PSZ)buf, 0, 0, 0)) DosBeep(200,200); } }
ULONG User_Error(HWND hwndOwner, ULONG ulWindow, ULONG ulStyle, UCHAR *pucMsg, PSZ pszErrMod, LONG lErrLine) { USHORT usResponse; /* Message box return value */ if(!pucMsg) pucMsg="Debug Information"; /* If no special test is given, assume debugging */ /* For query dialogs, don't include the (debugging) module and linenumber information (note: MB_QUERY equals MB_ICONQUESTION) */ if((ulStyle & MB_INFORMATION)==MB_QUERY) strcpy(ErrBuffer, pucMsg); else sprintf(ErrBuffer, "%s\n\nModule: %s\nLinenumber: %ld\n", pucMsg, pszErrMod, lErrLine); memset(Titlebar, ' ', TITLEBAR_LENGTH); Titlebar[TITLEBAR_LENGTH-1]='\0'; memcpy(Titlebar, "PC/2: User Information", sizeof("PC/2: User Information")-1); /* If the user requested not to be prompted, don't display the message if it is just an informational one (in the future we might log to file) */ if((pHP!=NULL) && (pHP->ulRuntimeFlag & NOPROMPT)) { if((ulStyle & MB_INFORMATION)==MB_QUERY) return(MBID_YES); if((ulStyle & MB_INFORMATION)==MB_INFORMATION) return(MB_OK); } /* Unfortunately, MB_INFORMATION equals MB_ICONQUESTION|MB_ICONEXCLAMATION, which is quite a silly */ if((ulStyle & MB_INFORMATION)==MB_INFORMATION) { /* Signal to user via speaker */ if((pHP!=NULL) && !(pHP->ulRuntimeFlag & NOPROMPT)) { DosBeep(1000,100); DosBeep(300,100); DosBeep(1000,200); } } usResponse=WinMessageBox(HWND_DESKTOP, hwndOwner, (PSZ)ErrBuffer, Titlebar, (USHORT)ulWindow, (USHORT)ulStyle); return(usResponse); }
static void DoBeep( void ) /************************/ { #if defined( __WINDOWS__ ) || defined( __NT__ ) MessageBeep( 0 ); #elif defined( __OS2__ ) DosBeep( 750, 250 ); #else putchar( 7 ); fflush( stdout ); #endif }
extern void Ring( void ) /**********************/ { #if defined( __DOS__ ) DoRingBell(); #elif defined( __WINDOWS__ ) || defined( __NT__ ) MessageBeep( 0 ); #elif defined( __QNX__ ) || defined( __LINUX__ ) write( STDOUT_FILENO, "\a", 1 ); #elif defined( __OS2__ ) DosBeep( 1000, 250 ); #endif }
/* * main - main entry point for PM */ int main( int argc, char *argv[] ) { HMQ hmq; QMSG qmsg; HAB hab; hab = WinInitialize( 0 ); if(!hab) { DosBeep(BEEP_WARN_FREQ, BEEP_WARN_DUR); DosExit(EXIT_PROCESS, RETURN_ERROR); } hmq = WinCreateMsgQueue( hab, 0 ); if(!hmq) { DosBeep(BEEP_WARN_FREQ, BEEP_WARN_DUR); WinTerminate(hab); DosExit(EXIT_PROCESS, RETURN_ERROR); } if( !imgEditInit( hab ) ) { DosBeep(BEEP_WARN_FREQ, BEEP_WARN_DUR); WinTerminate(hab); DosExit(EXIT_PROCESS, RETURN_ERROR); } IEEnableMenuInput( TRUE ); if( argc > 1 ) { parseCmdLine( argc, argv ); } while ( WinGetMsg(hab, &qmsg, 0, 0, 0) ) { WinDispatchMsg( hab, &qmsg ); } imgeditFini( hmq ); return 0; } /* main */
//============================================================================== // APIError -- report an error to the user as returned from an API service. // This function is provided mainly as a debugging tool to report // API errors to the user during runtime //============================================================================== VOID APIError(HWND hwndFrame,HWND hwndClient) { PERRINFO pErrInfoBlk; PSZ pszOffSet; void stdprint(void); PSZ pszErrMsg; DosBeep(100,10); DosBeep(440,110); if ((pErrInfoBlk = WinGetErrorInfo(Main::hab)) != NULL) { pszOffSet = ((PSZ)pErrInfoBlk) + pErrInfoBlk->offaoffszMsg; pszErrMsg = ((PSZ)pErrInfoBlk) + *((PSHORT)pszOffSet); if (hwndFrame && hwndClient) // if our window made it as far as definition, make the error window // owner be our application WinMessageBox(HWND_DESKTOP, // Parent window is desk top hwndFrame, // Owner window is our frame (PSZ)pszErrMsg, // PMWIN Error message "API Error Message", // Title bar message 64, // Message identifier MB_MOVEABLE | MB_CUACRITICAL | MB_CANCEL ); // Flags else // if our window errored in the definition part, make the desktop // the owner of the error box (since we have no window to own it!) WinMessageBox(HWND_DESKTOP, // Parent window is desk top HWND_DESKTOP, // Owner window is desktop (PSZ)pszErrMsg, // PMWIN Error message "API Error Message", // Title bar message 64, // Message identifier MB_MOVEABLE | MB_CUACRITICAL | MB_CANCEL ); // Flags // Discard the saved error info once we have used it WinFreeErrorInfo(pErrInfoBlk); } // upon fatal error, shutdown our application WinPostMsg(hwndClient, WM_QUIT, (ULONG)0, (ULONG)0); }
VOID DispErrorMsg(HAB hab, HWND hwndFrame, PCH FileName, LONG LineNum) { PERRINFO pErrInfoBlk; PSZ pszOffSet, pszErrMsg; ERRORID ErrorId; PCH ErrorStr; CHAR szbuff[125]; DosBeep(800,10); #if defined(DEBUG) DosBeep(800,10); DosBeep(800,10); DosBeep(800,10); DosBeep(800,10); DosBeep(800,10); #endif /* defined(DEBUG) */ if (!hab) { /* Non-PM Error */ WinLoadString( habMain,0, IDS_UNKNOWNMSG, sizeof(szbuff), (PSZ)szbuff); ErrorStr = (char*) malloc(strlen(szbuff)+strlen(FileName)+10); sprintf(ErrorStr, szbuff, FileName, LineNum); WinMessageBox(HWND_DESKTOP, /* Parent window is desk top */ hwndFrame, /* Owner window is our frame */ (PSZ)ErrorStr, /* PMWIN Error message */ szErrorTitle, /* Title bar message */ MSGBOXID, /* Message identifier */ MB_MOVEABLE | MB_CUACRITICAL | MB_CANCEL ); /* Flags */ free(ErrorStr); return; } ErrorId = WinGetLastError(hab); if ((pErrInfoBlk = WinGetErrorInfo(hab)) != (PERRINFO)NULL) { pszOffSet = ((PSZ)pErrInfoBlk) + pErrInfoBlk->offaoffszMsg; pszErrMsg = ((PSZ)pErrInfoBlk) + *((PULONG)pszOffSet); WinLoadString( habMain,0, IDS_ERRORMSG, sizeof(szbuff), (PSZ)szbuff); ErrorStr = (char *)malloc(strlen(szbuff)+strlen(pszErrMsg)+strlen(FileName)+10); sprintf(ErrorStr, szbuff, pszErrMsg, FileName, LineNum); WinMessageBox(HWND_DESKTOP, /* Parent window is desk top */ hwndFrame, /* Owner window is our frame */ (PSZ)ErrorStr, /* PMWIN Error message */ szErrorTitle, /* Title bar message */ MSGBOXID, /* Message identifier */ MB_MOVEABLE | MB_CUACRITICAL | MB_CANCEL ); /* Flags */ free(ErrorStr); WinFreeErrorInfo(pErrInfoBlk); } }
void cdecl main(int argc,char **argv) { int rc; rc=VioGlobalReg("GVIOSPY","VIOSERVICE", VR_VIOWRTNCHAR | VR_VIOWRTNATTR | VR_VIOWRTNCELL | VR_VIOWRTTTY | VR_VIOWRTCHARSTR | VR_VIOWRTCHARSTRATT | VR_VIOWRTCELLSTR | VR_VIOSCROLLUP | VR_VIOSCROLLDN | VR_VIOSCROLLLF | VR_VIOSCROLLRT | VR_VIOSETCURPOS | VR_VIOSHOWBUF , 0L,0L); if (rc!=0) { printf("Register Failed rc=%d\n",rc); exit(rc); return; } else DosBeep(400,50); }
int GetKeystroke2( void ) { int code, type; for(;;) { Kbd_Wait(); type=Kbd_GetType(); code=Kbd_GetCode(); if (type==KBD_ASCII) { DosBeep(400,400); continue; } else break; } return code; }
int main (int argc, char *argv[]) { HAB hab; HMQ hmq; QMSG qmsg; char text[CCHMAXPATH]; char title[CCHMAXPATH]; short a; HWND hwndClient; ULONG result; ULONG rc; /* Create a copy of the args */ /* argv[0]: progname argv[1]: installdir argv[2]: 0: query wave, 1: query mp3 argv[3]: wavefile */ numArgs=argc; hab=WinInitialize(0); if(hab) { hmq=WinCreateMsgQueue(hab,0); if(hmq) { /* Save installation directory */ /* Get our ressource dll */ WinRegisterClass(hab, CLASS_NAME, newProc,0, SLADDBYTES); if( WinDlgBox( HWND_DESKTOP, NULLHANDLE, waveinfoStatusDialogProc, NULLHANDLE, IDDL_PMTST, 0) == DID_ERROR ) { WinDestroyMsgQueue( hmq ); WinTerminate( hab ); DosBeep(100,600); return( 1 ); } WinDestroyMsgQueue(hmq); } WinTerminate(hab); } return 0; }
void dispmsg( union both_scr *posptr, int msgno) /**********************************************************************/ /* */ /* Display a message on the message line and optionally ring the */ /* bell. Error messages starting with ! ring the bell. */ /* */ /**********************************************************************/ /* */ /* This is ZEDIT source material. */ /* */ /* ZEDIT Source Materials are intellectual property */ /* (c) Copyright 1987,2001 by Clyde Thomas Zuber. */ /* */ /**********************************************************************/ { extern unsigned int graphic; extern char msgtext[MSGMAX][80]; int ln; if (!posptr) return; if (msgtext[msgno][0] == '!') #ifdef OS2 DosBeep(500, 75); #else printf("%c", BELL); #endif if (graphic & CGA) ln = 0; else ln = 24; dsp8lin(posptr, &msgtext[msgno][0], ln); revline(posptr, ln); if (graphic & XGA) xga8514(posptr, ln, RDSPLIN); } /* end dispmsg */
// Insert a Server Object int Container::insert(char *name,char *user,char *pass,ULONG arg1,ULONG arg2) { UserData *ud; UserData *parent = NULL; ud = allocateRecords(1); if (ud) { last_insert = ud; num_objects++; // set all the stuff in our record ud->setName(name); ud->setUsername(user); ud->setPassword(pass); ud->setType(TYPE_SERVER); ud->setIcons(icon_server,icon_server); ud->setCull(arg1); ud->setStart(arg2); // Build up insertion information RECORDINSERT ri; memset(&ri,0,sizeof(RECORDINSERT)); ri.cb = sizeof(RECORDINSERT); ri.zOrder = CMA_END; // add on top of siblings if (!parent || !parent->getCollapsed()) ri.fInvalidateRecord = TRUE; // re-arrange after insert ri.pRecordParent = (PRECORDCORE)parent; // set tree hierarchy ri.cRecordsInsert = 1; // number of records to insert ri.pRecordOrder = (RECORDCORE*)CMA_END; // add to end of list MRESULT rc = WinSendMsg(cont,CM_INSERTRECORD,MPFROMP((PRECORDCORE)ud),MPFROMP(&ri)); if (rc == 0) message("CM_INSERTRECORD returned %d",rc); return 1; } else { DosBeep(100,100); return 0; } }
VOID main(VOID) { USHORT usReturn_Code; /* Dos function Return Code */ PSZ pszName = SHARENAME; /* Shareable memory block name */ SEL selMem_Selector; /* Receive Segment selector */ PSZ pszSemName = SEMNAME; /* System semaphore name */ HSEM hsemSemHandle; /* System semaphore Handle */ WATCH FAR * Watch_Ptr; /* WATCH pointer */ /* Get Access to Shareable memory Block */ usReturn_Code = DosGetShrSeg(pszName, & selMem_Selector); if (usReturn_Code == 0) { Watch_Ptr = (WATCH FAR *) MAKEP(selMem_Selector,0); DosOpenSem( & hsemSemHandle, /* Open System semaphore */ pszSemName); DosSemRequest(hsemSemHandle, /* Waits for shared resources */ SEM_INDEFINITE_WAIT); /* Restore Init value count if WATCHDOG enabled */ if (Watch_Ptr->Flag & ENABLE_MASK) Watch_Ptr->Counter = Watch_Ptr->Counter_Init_Value ; DosSemClear(hsemSemHandle); /* Release shared resources */ DosFreeSeg(selMem_Selector); /* Freeing Shared memory */ } else { DosBeep(262,250);DosBeep(330,250);DosBeep(392,250);DosBeep(494,250); DosBeep(392,250);DosBeep(330,250);DosBeep(262,250); #ifdef DEBUG printf("\n -*-*- STARTTPS Error Code %04x -*-*-\n",usReturn_Code); printf(" -*- WatchDog not Started -*-\n"); #endif } /* endif */ DosExit((USHORT) 0,usReturn_Code); /* Exit Process */ } /* end of main program */
static errr Term_xtra_pipe_emx(int n, int v) { termPipe *tp=(termPipe*)Term; switch (n) { case TERM_XTRA_NOISE: DosBeep(440, 50); return (0); case TERM_XTRA_SHAPE: return (0); case TERM_XTRA_EVENT: return (CheckEvents(FALSE)); } return (1); }
LONG loadFile (char *fn) { HFILE file; /* handle */ ULONG ac; /* action code (from DosOpen) */ APIRET rc; /* return code (from API functions) */ ULONG rd; /* bytes actually read */ ULONG cbSize; /* file size in bytes */ ULONG dummy; /* used when seeking back to beginning of file */ /* try to open existing file -- access */ rc = DosOpen (fn, &file, &ac, 0, 0, OPEN_ACTION_OPEN_IF_EXISTS, OPEN_FLAGS_SEQUENTIAL | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0); if (rc != 0) /* failed */ return (0); DosChgFilePtr (file, 0L, 2, &cbSize); /* determine file size */ if (cbSize > 30000L) { DosBeep(3700, 100); DosClose (file); return (-1); } DosChgFilePtr (file, 0L, 0, &dummy); /* reset pointer to beginning */ rc = DosAllocMem(&iobuf, /* Allocate memory object */ (INT)cbSize, /* Size of memory object */ PAG_COMMIT | /* Commit memory immediately */ PAG_READ | /* Allow read access */ PAG_WRITE); /* Allow write access */ if (rc != 0) return (0); /* read entire file into buffer */ DosRead (file, iobuf, cbSize, &rd); DosClose (file); return (LONG)cbSize; }
VOID MainUpdateMsg(HWND hwnd, CHAR PipeMsgs[MAX_MESSAGES][MESSAGE_LEN], unsigned int index, SHORT sTotalMsgs) { RECTL rclInvalid; /* if it will fit in the window */ if (sTotalMsgs <= cyClient/cyChar + sVscrollPos + 1) { rclInvalid.yBottom = max(0, cyClient - sTotalMsgs * cyChar); rclInvalid.yTop = (cyClient - (sTotalMsgs - sVscrollPos - 1) * cyChar); rclInvalid.xLeft = 0; rclInvalid.xRight = cxClient; WinInvalidateRect(hwnd, &rclInvalid, FALSE); MainPaint(hwnd, PipeMsgs, index, sTotalMsgs); } /* if lines exceed window */ if (sTotalMsgs > cyClient/cyChar) { WinEnableWindow (hwndVscroll, TRUE) ; sVscrollMax = sTotalMsgs - cyClient / cyChar; sVscrollPos = min (sVscrollPos, sVscrollMax) ; WinSendMsg (hwndVscroll, SBM_SETSCROLLBAR, MPFROM2SHORT (sVscrollPos, 0), MPFROM2SHORT (0, sVscrollMax)) ; /* if new msg is just off screen */ if (sTotalMsgs == cyClient/cyChar + sVscrollPos + 1) { MainVertScroll(hwnd, MPFROM2SHORT(0, SB_LINEDOWN)); } /* tell user message was received */ else { DosBeep(1000, 100); } } }
//------------ // MsgConnect \ //--------------------------------------------------------------------------- // Event: PM_CONNECT // Cause: Issued by the connection thread when a connection has been // established // void *C_WINDOW_MAIN::MsgConnect( void *mp1, void *mp2 ) { // Tell the user he is connected pxcStatus->Text( "Connected to %s...", ServerAddress() ); // Enable menu options so the user can select information pxcMenu->EnableItem( DM_WINDOWS ); // Enable the toolbar buttons pxcTBar->ButtonEnable( DB_WND_GRP, TRUE ); pxcTBar->ButtonEnable( DB_WND_SUB, TRUE ); // Give the user some audible feedback to say that we've connected DosBeep( 100, 100 ); // since we are now connected, open the subscription window and tell // it to update. SendMsg( WM_COMMAND, (void *)DM_SUBSCRIPTIONS, 0 ); return FALSE; }
/************************************************************************** * * Name : AbortHello * * Description: Report an error returned from an API service * * Concepts : use of message box to display information * * API's : DosBeep * WinGetErrorInfo * WinMessageBox * WinFreeErrorInfo * WinPostMsg * * Parameters : hwndFrame = frame window handle * hwndClient = client window handle * * Return : [none] * *************************************************************************/ VOID AbortHello(HWND hwndFrame, HWND hwndClient) { PERRINFO pErrInfoBlk; PSZ pszOffSet; void stdprint(void); DosBeep(100,10); if ((pErrInfoBlk = WinGetErrorInfo(hab)) != (PERRINFO)NULL) { pszOffSet = ((PSZ)pErrInfoBlk) + pErrInfoBlk->offaoffszMsg; pszErrMsg = ((PSZ)pErrInfoBlk) + *((PSHORT)pszOffSet); if((INT)hwndFrame && (INT)hwndClient) WinMessageBox(HWND_DESKTOP, /* Parent window is desk top */ hwndFrame, /* Owner window is our frame */ (PSZ)pszErrMsg, /* PMWIN Error message */ "Error Msg", /* Title bar message */ MSGBOXID, /* Message identifier */ MB_MOVEABLE | MB_CUACRITICAL | MB_CANCEL ); /* Flags */ WinFreeErrorInfo(pErrInfoBlk); } WinPostMsg(hwndClient, WM_QUIT, (MPARAM)NULL, (MPARAM)NULL); } /* End of AbortHello */
// manages changes in size VOID WndResize( const HWND hwnd ) { wcprintf("WndResize"); RECTL rWindow; LONG cyHeight, cxWidth; BITMAPINFOHEADER bmp; if( (hbmGlob = GpiSetBitmap( hpsBufferGlob, NULLHANDLE )) != NULLHANDLE ){ wcprintf("wndresize: there was an old bitmap"); GpiDeleteBitmap( hbmGlob ); // delete old stuff } else wcprintf("wndresize: there was no old bitmap"); // build the bitmap: WinQueryWindowRect( hwnd, &rWindow ); cxWidth = rWindow.xRight - rWindow.xLeft;// - 2; cyHeight = rWindow.yTop - rWindow.yBottom; // - 2; wcprintf("wndResize: Breite: %d, H”he: %d", rWindow.xRight, rWindow.yTop ); memset(&bmp, 0, sizeof(BITMAPINFOHEADER)); bmp.cbFix = sizeof(BITMAPINFOHEADER); bmp.cx = (SHORT)cxWidth; bmp.cy = (SHORT)cyHeight; bmp.cPlanes = (SHORT)cColorPlanes; bmp.cBitCount = (SHORT)cColorBitCount; hbmGlob = GpiCreateBitmap(hpsBufferGlob, (PBITMAPINFOHEADER2)&bmp, 0L, NULL, NULL); if( hbmGlob == GPI_ERROR ) DosBeep( 100, 500); GpiSetBitmap( hpsBufferGlob, hbmGlob); // calculate the size // if( !GpiSetPageViewport(hpsGlob, &rWindow) ) // wcprintf("error 1"); return; if( !GpiSetPageViewport(hpsBufferGlob, &rWindow) ) wcprintf("error 2"); }
static VOID AbortLocker( HWND hwndFrame, HWND hwndClient ) { PERRINFO pErrInfoBlk; PSZ pszOffSet; PSZ pszErrMsg; DosBeep( 100, 10 ); if( ( pErrInfoBlk = WinGetErrorInfo(Hab) ) != (PERRINFO)NULL ) { pszOffSet = ((PSZ)pErrInfoBlk) + pErrInfoBlk->offaoffszMsg; pszErrMsg = ((PSZ)pErrInfoBlk) + *((PSHORT)pszOffSet); if( (INT)hwndFrame && (INT)hwndClient ) { WinMessageBox(HWND_DESKTOP, /* Parent window is desk top */ hwndFrame, /* Owner window is our frame */ (PSZ)pszErrMsg, /* PMWIN Error message */ TRP_The_WATCOM_Debugger, /* Title bar message */ MSGBOXID, /* Message identifier */ MB_MOVEABLE | MB_CUACRITICAL | MB_CANCEL ); /* Flags */ } WinFreeErrorInfo( pErrInfoBlk ); } WinPostMsg( hwndClient, WM_QUIT, (MPARAM)NULL, (MPARAM)NULL ); }
void Ring_Bell( void ) { DosBeep( 1000, 250 ); }
/****************************************************************\ * Main routine *-------------------------------------------------------------- * * Name: main() * * Purpose: Initializes the PM environment, calls the * initialization routine, creates the main * window, and polls the message queue * * Usage: * * Method: * - obtains anchor block handle and creates message * queue * - calls the initialization routine * - creates the main frame window which creates the * main client window * - polls the message queue via Get/Dispatch Msg loop * - upon exiting the loop, exits * * Returns: * 0 - if successful execution completed * 1 - if error \****************************************************************/ INT main(int argc, char *argv[]) { QMSG qmsg; /* message structure */ static int iTimeOut = THRD_EXIT_TIMEOUT; hab = WinInitialize(0UL); if(!hab) { DosBeep(BEEP_WARN_FREQ, BEEP_WARN_DUR); return RETURN_ERROR; } hmq = WinCreateMsgQueue(hab, 0L); if(!hmq) { DosBeep(BEEP_WARN_FREQ, BEEP_WARN_DUR); WinTerminate(hab); return RETURN_ERROR; } if(!Init(argc, argv)) { if(hwndMainFrame == NULLHANDLE) { MessageBox(HWND_DESKTOP, IDMSG_MAINWINCREATEFAILED, MB_OK | MB_ERROR, TRUE); } else { MessageBox(HWND_DESKTOP, IDMSG_INITFAILED, MB_OK | MB_ERROR, TRUE); } DosBeep(BEEP_WARN_FREQ, BEEP_WARN_DUR); if (WinIsWindow(hab, hwndMainFrame)) { WinDestroyWindow(hwndMainFrame); } WinDestroyMsgQueue(hmq); WinTerminate(hab); return RETURN_ERROR; } /* Get-Dispatch Message loop */ while(WinGetMsg(hab, &qmsg, NULLHANDLE, 0UL, 0UL)) WinDispatchMsg(hab, &qmsg); /* destroy the help instance */ DestroyHelpInstance(); if (WinIsWindow(hab, hwndMainFrame)) WinDestroyWindow(hwndMainFrame); WinDestroyMsgQueue(hmq); /* give other thread a chance to exit */ while (!fThrdsDead && iTimeOut--) { DosSleep(0UL); } WinTerminate(hab); return RETURN_SUCCESS; } /* main() */
/* * Method: Horn::Beep * * Description: * * Beeps the horn using the data stored in the object. */ VOID Horn::Beep(VOID) { DosBeep(QueryHighTone(), QueryDuration()); DosSleep(100); DosBeep(QueryLowTone(), QueryDuration()); }