home *** CD-ROM | disk | FTP | other *** search
- // (C) Copyright Microsoft Corp. 1991. All rights reserved.
- //
- // You have a royalty-free right to use, modify, reproduce and
- // distribute the Sample Files (and/or any modified version) in
- // any way you find useful, provided that you agree that
- // Microsoft has no warranty obligations or liability for any
- // Sample Application Files which are modified.
-
-
- /****************************************************************************
-
- MODULE : Utils.c
-
- PURPOSE : This module contains helper/utility functions for the application playvfw.
-
- FUNCTIONS :
- ReadTextFileIntoEdit
- GetRandNumber123
- ExtractExtension
- StripSpaces
- ReturnCoor
- GetRealClientRect
- DrawRectOutsideButton
- PlayVFWPaint
- Cleanup
- Playback
- f256Capable
- fHiResCapable
- fVgaCapable
-
- COMMENTS :
-
- HISTORY :
-
- ****************************************************************************/
-
- #include "windows.h"
- #include <stdlib.h>
- #include "playvfw.h"
- #include "proto.h"
- #include "mmsystem.h"
- #include <digitalv.h>
- #include <stdio.h>
- #include <time.h>
- #include <io.h>
- #include <viewer.h>
-
- /****************************************************************************
-
- FUNCTION : ReadTextFileIntoEdit()
-
- PURPOSE : This function reads a text file specified in the ini file into an edit control.
-
- COMMENTS :
-
- HISTORY : Created by Steven Molstad 8/1/93.
-
- ****************************************************************************/
-
- BOOL FAR PASCAL ReadTextFileIntoEdit()
- {
- OFSTRUCT pof;
- HANDLE hFile;
- int nBytes;
- int bytes;
- LPSTR lpFileName;
- HANDLE hFileName;
- HANDLE hExeName;
- HANDLE hBuffer;
- LPSTR lpExeName;
- LPSTR lpBuffer;
- LPSTR lpTmpBuf;
- int i;
-
- hFileName=GlobalAlloc(GHND,128);
- hExeName=GlobalAlloc(GHND,10);
- hBuffer=GlobalAlloc(GHND,80+1);
- if (hFileName && hExeName && hBuffer)
- {
- lpFileName=GlobalLock(hFileName);
- lpExeName=GlobalLock(hExeName);
- lpBuffer=GlobalLock(hBuffer);
- if(lpFileName && hExeName && hBuffer)
- {
- nBytes=GetModuleFileName(GetModuleHandle("playvfw.exe"),lpFileName,128);
- if(nBytes)
- {
- ExtractExtension(lpFileName,lpExeName);
-
- if(!lstrlen(lpDevice1->szFileName))
- {
- MessageBox(hWndMain,"Text File Name is invalid","ERROR",MB_OK);
- return FALSE;
- }
-
- lstrcat(lpFileName,lpDevice1->szFileName);
- hFile=OpenFile(lpFileName,&pof,OF_READWRITE);
-
- if (hFile==-1)
- {
- MessageBox(hWndMain,"Unable to open File","Check that text file exists",MB_OK);
- return FALSE;
- }
-
- _llseek (hFile,0L,0);
-
- bytes=_lread(hFile,lpBuffer,80);
-
- while(bytes==80)
- {
- lpTmpBuf=lpBuffer;
-
- for(i=0;i<80;++i)
- ++lpTmpBuf;
-
- *lpTmpBuf='\0';
-
-
- SendMessage(hWndEdit,EM_REPLACESEL,0,(LONG)lpBuffer);
- bytes=_lread(hFile,lpBuffer,80);
-
- }
-
- if (bytes>0)
- {
- lpTmpBuf=lpBuffer;
-
- for(i=0;i<bytes;++i)
- ++lpTmpBuf;
-
- *lpTmpBuf='\0';
-
- SendMessage(hWndEdit,EM_REPLACESEL,0,(LONG)lpBuffer);
- }
- }// if nBytes
- else
- {
- MessageBox(hWndMain,"couldn't get pathname","ERROR",MB_OK);
- return FALSE;
- }
- }// if global lock
- else
- {
- MessageBox(hWndMain,"Global Lock Failed","ERROR",MB_OK);
- return FALSE;
- }
- }// if global alloc
- else
- {
- MessageBox(hWndMain,"Global Alloc failed","ERROR",MB_OK);
- return FALSE;
- }
- return TRUE;
- }
-
- /****************************************************************************
-
- FUNCTION : GetRandNumber123()
-
- PURPOSE : This function retrieves a random number using the C runtime and returns it.
-
- COMMENTS :
-
- HISTORY : Created by Steven Molstad 8/1/93.
-
- ****************************************************************************/
-
- int FAR PASCAL GetRandNumber123()
- {
-
-
-
- /* Seed the random number generator with current time so that
- * the numbers will be different every time we run.
- */
- srand( (unsigned)time( NULL ) );
-
- /* Display 10 numbers. */
-
- return (rand() % 3)+1;
-
- }
-
-
- // lpFileName will be of the form "c:\stuff\"
- /****************************************************************************
-
- FUNCTION : ExtractExtension(LPSTR,LPSTR)
-
- PURPOSE : This function takes a full path name and executable and truncates off the executable
- name. i.e. c:\stuff\playvfw.exe passes back c:\stuff\.
-
- COMMENTS :
-
- HISTORY :
-
- ****************************************************************************/
-
-
- BOOL FAR PASCAL ExtractExtension(lpFileName,lpExeName)
- LPSTR lpFileName;
- LPSTR lpExeName;
- {
- LPSTR lpF;
- LPSTR lpFTemp;
- LPSTR lpETemp;
- HANDLE hTempExe;
- LPSTR lpTempExe;
- LPSTR lpE2Temp;
-
- lpF=lpFileName;
-
- // set the pointer to the end of the string.
-
- while (*lpF!='\0')
- {
- lpFTemp++;
- lpF++;
- }
-
- // if the string is empty return an error;
-
- if (lpF!=lpFileName)
- lpF--;
-
- // scan back for a period in the file name, throwing out the extension.
-
- while ((*lpF!='.') && (lpF!=lpFileName) && (*lpF!='\\'))
- lpF--;
-
- // incorrect the file didn't have a path or an extension.
-
- if (lpF==lpFileName)
- {
- MessageBox(hWndMain,"Invalid File Extension","ERROR",MB_OK);
- return FALSE;
- }
-
- // if we didn't find a period there mustn't have been an extension. Reset
- // to end of string. Otherwise skip the period.
-
- if(*lpF=='\\')
- lpF=lpFTemp;
- else
- lpF--;
-
- // scan string until a \ is found.
-
- hTempExe=GlobalAlloc(GHND,128);
- if (hTempExe)
- {
- lpTempExe=GlobalLock(hTempExe);
- if (lpTempExe)
- {
- // set up a third party variable.
-
- lpETemp=lpTempExe;
-
- // read the string backwards into the temporary variable.
-
- while ((*lpF!='\\') && (lpF!=lpFileName))
- *lpETemp++=*lpF--;
-
- *lpETemp='\0';
- lpETemp--;
-
- // reread the string backwards and place it into the Exe name
- // variable in its correct (forward order).
-
- lpE2Temp=lpExeName;
-
- while (lpETemp!=lpTempExe)
- *lpE2Temp++=*lpETemp--;
-
- // get the last character or the first character depending on how
- // you look at it.
-
- *lpE2Temp++=*lpETemp;
-
- *lpE2Temp='\0';
- }
-
- GlobalUnlock(hTempExe);
- GlobalFree(hTempExe);
- }
- // if we are at the begining of the string and a \ was not found error.
-
-
- if (lpF==lpFileName)
- {
- MessageBox(hWndMain,"Invalid File Extension","ERROR",MB_OK);
- return FALSE;
- }
-
- // increment one past the last backslash and add a null to terminate string.
-
- lpF++;
- *lpF='\0';
-
- return TRUE;
- }
-
- /****************************************************************************
-
- FUNCTION : StripSpaces(LPSTR)
-
- PURPOSE : This function takes a string and strips all spaces out of the string.
-
- COMMENTS :
-
- HISTORY : Created by Steven Molstad 8/1/93.
-
- ****************************************************************************/
-
- BOOL FAR PASCAL StripSpaces(lpBuffer)
- LPSTR lpBuffer;
- {
- LPSTR lpNew;
- LPSTR lpOld;
-
- lpNew=lpBuffer;
- lpOld=lpBuffer;
-
- while (*lpNew!='\0')
- if (*lpNew==' ')
- lpNew++;
- else
- *lpOld++=*lpNew++;
-
- *lpOld='\0';
-
- return TRUE;
- }
-
- /****************************************************************************
-
- FUNCTION : ReturnCoor(lpBuff,lpPoints)
-
- PURPOSE : This function takes a string of points as 12,12,100,100 and breaks it into
- the appropriate x,y,dx,dy components of a points structure.
-
- COMMENTS :
-
- HISTORY : Created by Steven Molstad 8/1/93
-
- ****************************************************************************/
-
- BOOL FAR PASCAL ReturnCoor(lpBuff,lpPoints)
- LPSTR lpBuff;
- LPRECT lpPoints;
- {
- char szNum[10];
- int nCoor;
- LPSTR lpPB;
- LPSTR lpNum;
-
- lpPB=lpBuff;
- lpNum=szNum;
-
- while ((*lpPB!='\0') && (*lpPB!=','))
- *lpNum++=*lpPB++;
-
- if (*lpPB=='\0')
- {
- MessageBox(hWndMain,"incorrect position string","ERROR",MB_OK);
- return FALSE;
- }
-
- *lpNum='\0';
-
- nCoor=atoi(szNum);
- lpPoints->left=nCoor;
-
- lpNum=szNum;
- lpPB++;
-
- while ((*lpPB!='\0') && (*lpPB!=','))
- *lpNum++=*lpPB++;
-
- if (*lpPB=='\0')
- {
- MessageBox(hWndMain,"incorrect position string","ERROR",MB_OK);
- return FALSE;
- }
-
- *lpNum='\0';
-
- nCoor=atoi(szNum);
- lpPoints->top=nCoor;
-
- lpNum=szNum;
- lpPB++;
-
- while ((*lpPB!='\0') && (*lpPB!=','))
- *lpNum++=*lpPB++;
-
- if (*lpPB=='\0')
- {
- MessageBox(hWndMain,"incorrect position string","ERROR",MB_OK);
- return FALSE;
- }
-
- *lpNum='\0';
-
- nCoor=atoi(szNum);
- lpPoints->right=nCoor;
-
- lpNum=szNum;
- lpPB++;
-
- while ((*lpPB!='\0') && (*lpPB!=','))
- *lpNum++=*lpPB++;
-
- if (*lpPB==',')
- {
- MessageBox(hWndMain,"incorrect position string","ERROR",MB_OK);
- return FALSE;
- }
-
- *lpNum='\0';
-
- nCoor=atoi(szNum);
- lpPoints->bottom=nCoor;
-
- return TRUE;
- }
-
- /****************************************************************************
-
- FUNCTION : GetRealClientRect(HWND,HWND,LPRECT)
-
- PURPOSE : This function takes a rect structure and returns client coordinates in that structure. It
- also takes the child and parent that you want relative coordinates for. The child being
- relative to the client area of the parent vs the upper left hand corner of the screen.
-
- COMMENTS :
-
- HISTORY : Created by Steven Molstad 8/1/93.
-
- ****************************************************************************/
-
- BOOL FAR PASCAL GetRealClientRect(hWndChild,hWndParent,lpWinRect)
- HWND hWndChild;
- HWND hWndParent;
- LPRECT lpWinRect;
- {
-
- POINT ptUpperLeft;
- POINT ptLowerRight;
-
- GetWindowRect(hWndChild,lpWinRect);
-
-
- ptUpperLeft.x=lpWinRect->left;
- ptUpperLeft.y=lpWinRect->top;
- ptLowerRight.x=lpWinRect->right;
- ptLowerRight.y=lpWinRect->bottom;
-
- ScreenToClient(hWndParent,&ptLowerRight);
- ScreenToClient(hWndParent,&ptUpperLeft);
-
- lpWinRect->left=ptUpperLeft.x;
- lpWinRect->top=ptUpperLeft.y;
- lpWinRect->right=ptLowerRight.x;
- lpWinRect->bottom=ptLowerRight.y;
-
- return TRUE;
-
- }
-
- /****************************************************************************
-
- FUNCTION : DrawRectOutsideButton(HWND,RECT)
-
- PURPOSE : This function draws a rectangle around an owner draw button who's rectangular area is
- specified by WinRect. hWnd is the window handle to the parent.
-
- COMMENTS :
-
- HISTORY :
-
- ****************************************************************************/
-
- BOOL FAR PASCAL DrawRectOutsideButton(hWnd,WinRect)
- HWND hWnd;
- RECT WinRect;
-
- {
- HDC hWinDC;
- HPEN hWinPen;
- HPEN hPenOld;
-
- hWinDC=GetDC(hWnd);
-
- hWinPen=CreatePen(PS_SOLID,4,RGB(0,0,0));
- hPenOld=SelectObject(hWinDC,hWinPen);
-
- Rectangle(hWinDC,WinRect.left-2,WinRect.top-2,WinRect.right+2,WinRect.bottom+2);
-
- SelectObject(hWinDC,hPenOld);
- DeleteObject(hWinPen);
-
- ReleaseDC(hWnd,hWinDC);
-
- return TRUE;
- }
-
- /****************************************************************************
-
- FUNCTION : PlayVFWPaint( HDC )
-
- PURPOSE : This procedure is no longer used but was called whenever the application needed to
- paint the client area.
-
- COMMENTS :
-
- HISTORY : Created by Steven Molstad 6/1/93.
-
- ****************************************************************************/
-
- void PlayVFWPaint( hDC )
- HDC hDC;
- {
-
- //HDC hdc;
- HDC hdcMemory;
- HBITMAP hbmpMyBitmap, hbmpOld;
- BITMAP bm;
- // Set the Background color to black.
-
- SetBkColor(hDC,RGB(255,255,255));
-
-
- if (bIsPage0)
- {
- hbmpMyBitmap = LoadBitmap(hInst, "vgalogo4");
- GetObject(hbmpMyBitmap, sizeof(BITMAP), &bm);
-
- //hdc = GetDC(hwnd);
- hdcMemory = CreateCompatibleDC(hDC);
- hbmpOld = SelectObject(hdcMemory, hbmpMyBitmap);
-
- BitBlt(hDC, 0, 0, bm.bmWidth, bm.bmHeight, hdcMemory, 0, 0, SRCCOPY);
- SelectObject(hdcMemory, hbmpOld);
-
- DeleteDC(hdcMemory);
-
- //ReleaseDC(hwnd, hdc);
- }
- return;
- }
-
- /****************************************************************************
-
- FUNCTION : LoadPalette()
-
- PURPOSE : This procedure is no longer used but is usefull code to load a palette and retieve the
- handle to that palette.
-
-
- COMMENTS :
-
- HISTORY : Create by Steven Molstad 6/1/93.
-
- ****************************************************************************/
-
- BOOL FAR PASCAL LoadPalette()
- {
- HFILE hfReadWriteFile;
-
-
-
- int bytes;
- HANDLE hBuff;
- LPLOGPALETTE lpBuff;
- HANDLE hLogPal;
- LPLOGPALETTE lpLogPal;
- UINT palsize;
-
- hfReadWriteFile=_lopen("palette.pal",READ);
-
- if (hfReadWriteFile == HFILE_ERROR)
- {
- MessageBox(hWndMain,"Cannot find file palette.pal","ERROR",MB_OK);
- return FALSE;
- }
-
- /* Allocate a buffer for file I/O. */
-
- hBuff=GlobalAlloc(GHND, sizeof(LOGPALETTE));
-
- if (hBuff)
- {
- lpBuff=(LPLOGPALETTE)GlobalLock(hBuff);
-
- if (lpBuff)
- {
- _llseek(hfReadWriteFile,20,0);
- bytes=_lread(hfReadWriteFile, lpBuff, sizeof(LOGPALETTE));
-
- //
- //allocate memory for the logical palette including the array of
- //palette entries
- //
-
- palsize = sizeof(LOGPALETTE) + (sizeof (PALETTEENTRY) * lpBuff->palNumEntries);
-
- hLogPal = GlobalAlloc( GHND, palsize );
-
- if(hLogPal)
- {
- lpLogPal=(LPLOGPALETTE)GlobalLock(hLogPal);
- if (lpLogPal)
- {
-
-
- _llseek(hfReadWriteFile,20,0);
-
- bytes=_lread(hfReadWriteFile,lpLogPal,palsize);
-
- //
- //create the palette
- //
-
- hPal = CreatePalette((LPLOGPALETTE)lpLogPal);
- //{
- // SelectPalette(hDC, hPal, FALSE);
- // RealizePalette(hDC);
- //}
-
- GlobalUnlock(hBuff);
- GlobalFree(hBuff);
-
- }
- else
- {
- MessageBox(hWndMain,"Global Lock Failed in Palette stuff","ERROR",MB_OK);
- return FALSE;
- }
-
- GlobalUnlock(hLogPal);
- GlobalFree(hLogPal);
- }
-
- else
- {
- MessageBox(hWndMain,"Global Alloc Failed in Palette stuff","ERROR",MB_OK);
- return FALSE;
- }
- }
- }
- /* Free the buffer and close the files. */
-
- _lclose(hfReadWriteFile);
-
-
- return TRUE;
- }
-
-
-
-
- /****************************************************************************
-
- FUNCTION : Cleanup(void)
-
- PURPOSE : This function does the cleanup work for the application. It takes care of freeing all
- window handles and cursors.
-
- COMMENTS :
-
- HISTORY : Created by Steven Molstad 8/15/93.
-
- ****************************************************************************/
-
- BOOL FAR PASCAL Cleanup(void)
- {
-
- if (VWRGlobal)
- {
- VwrQuit(VWRGlobal);
- VWRGlobal=0;
- }
-
- FreeDevices(hWndMain);
-
-
-
- if (hWndButtonBar)
- DestroyWindow(hWndButtonBar);
-
- if (lpDevice1->hWnd)
- DestroyWindow(lpDevice1->hWnd);
-
- if (lpDevice2->hWnd)
- DestroyWindow(lpDevice2->hWnd);
-
- if (lpDevice3->hWnd)
- DestroyWindow(lpDevice3->hWnd);
-
- if (lpDevice4->hWnd)
- DestroyWindow(lpDevice4->hWnd);
-
- if (lpDevice5->hWnd)
- DestroyWindow(lpDevice5->hWnd);
-
- if (lpDevice6->hWnd)
- DestroyWindow(lpDevice6->hWnd);
-
- if (lpDevice7->hWnd)
- DestroyWindow(lpDevice7->hWnd);
-
- if (lpDevice8->hWnd)
- DestroyWindow(lpDevice8->hWnd);
-
- if (lpDevice9->hWnd)
- DestroyWindow(lpDevice9->hWnd);
-
- SetCursor(hHelloCursor);
-
- DestroyCursor(lpDevice1->hCursor);
- DestroyCursor(lpDevice2->hCursor);
- DestroyCursor(lpDevice3->hCursor);
- DestroyCursor(lpDevice4->hCursor);
- DestroyCursor(lpDevice5->hCursor);
- DestroyCursor(lpDevice6->hCursor);
-
-
- GlobalUnlock(hDevice1);
- GlobalFree(hDevice1);
-
- GlobalUnlock(hDevice2);
- GlobalFree(hDevice2);
-
- GlobalUnlock(hDevice3);
- GlobalFree(hDevice3);
-
- GlobalUnlock(hDevice4);
- GlobalFree(hDevice4);
-
- GlobalUnlock(hDevice5);
- GlobalFree(hDevice5);
-
- GlobalUnlock(hDevice6);
- GlobalFree(hDevice6);
-
- GlobalUnlock(hDevice7);
- GlobalFree(hDevice7);
-
- GlobalUnlock(hDevice8);
- GlobalFree(hDevice8);
-
- GlobalUnlock(hDevice9);
- GlobalFree(hDevice9);
-
- DestroyWindow(hWndMain);
- return TRUE;
- }
-
- /****************************************************************************
-
- FUNCTION : Playback(WORD, HWND)
-
- PURPOSE : This function plays back a Video and Audio file when the cursor is placed over the
- corresponding owner draw button.
-
- COMMENTS :
-
- HISTORY : Created by Steven Molstad 6/1/93.
-
- ****************************************************************************/
-
- BOOL FAR PASCAL Playback(wParam,hOld)
- WORD wParam;
- HANDLE hOld;
- {
-
- if(wParam==lpDevice1->hWnd)
- {
- if (hOld!=wParam)
- {
- if(bIsPage1)
- SetCursor(lpDevice1->hCursor);
-
- if (!lpDevice1->bAudioPlaying)
- StopAllWaveFiles();
-
-
- if(!lpDevice1->bVideoPlaying)
- {
-
- SeekAllToStart();
-
- if (lpDevice1->bPlayVideo)
- PlayVFWFile(hWndMain,lpDevice1->hWnd,lpDevice1->wDeviceID);
-
- if (lpDevice1->bPlayAudio)
- PlayWaveFile(lpDevice1->wAudioDeviceID);
-
-
- lpDevice1->bVideoPlaying=TRUE;
- lpDevice1->bAudioPlaying=TRUE;
-
-
- //break;
- }
- hOld=wParam;
- }
-
- return TRUE;
- }
-
- if(wParam==lpDevice2->hWnd)
- {
- if (hOld!=wParam)
- {
-
- if(bIsPage1)
- SetCursor(lpDevice2->hCursor);
-
- if (!lpDevice2->bAudioPlaying)
- StopAllWaveFiles();
-
- if(!lpDevice2->bVideoPlaying)
- {
-
-
- SeekAllToStart();
-
- if (lpDevice2->bPlayVideo)
- PlayVFWFile(hWndMain,lpDevice2->hWnd,lpDevice2->wDeviceID);
-
- if (lpDevice2->bPlayAudio)
- PlayWaveFile(lpDevice2->wAudioDeviceID);
-
- lpDevice2->bVideoPlaying=TRUE;
- lpDevice2->bAudioPlaying=TRUE;
-
- //break;
- }
-
- hOld=wParam;
- }
- return TRUE;
- }
-
-
- if(wParam==lpDevice3->hWnd)
- {
- if (hOld!=wParam)
- {
- if(bIsPage1)
- SetCursor(lpDevice3->hCursor);
-
- if (!lpDevice3->bAudioPlaying)
- StopAllWaveFiles();
-
- if(!lpDevice3->bVideoPlaying)
- {
-
-
- SeekAllToStart();
-
-
- if (lpDevice3->bPlayVideo)
- PlayVFWFile(hWndMain,lpDevice3->hWnd,lpDevice3->wDeviceID);
-
- if (lpDevice3->bPlayAudio)
- PlayWaveFile(lpDevice3->wAudioDeviceID);
-
- lpDevice3->bVideoPlaying=TRUE;
- lpDevice3->bAudioPlaying=TRUE;
-
- //break;
- }
-
- hOld=wParam;
- }
-
- return TRUE;
- }
-
- if(wParam==lpDevice4->hWnd)
- {
- if (hOld!=wParam)
- {
- if(bIsPage1)
- SetCursor(lpDevice4->hCursor);
-
- if (!lpDevice4->bAudioPlaying)
- StopAllWaveFiles();
-
- if(!lpDevice4->bVideoPlaying)
- {
-
-
- SeekAllToStart();
-
-
- if (lpDevice4->bPlayVideo)
- PlayVFWFile(hWndMain,lpDevice4->hWnd,lpDevice4->wDeviceID);\
-
- if (lpDevice4->bPlayAudio)
- PlayWaveFile(lpDevice4->wAudioDeviceID);
-
- lpDevice4->bVideoPlaying=TRUE;
- lpDevice4->bAudioPlaying=TRUE;
-
-
- //break;
- }
- hOld=wParam;
- }
-
- return TRUE;
- }
-
-
- if(wParam==lpDevice5->hWnd)
- {
- if (hOld!=wParam)
- {
- if(bIsPage1)
- SetCursor(lpDevice5->hCursor);
-
- if (!lpDevice5->bAudioPlaying)
- StopAllWaveFiles();
-
- if(!lpDevice5->bVideoPlaying)
- {
-
- SeekAllToStart();
-
- if (lpDevice5->bPlayVideo)
- PlayVFWFile(hWndMain,lpDevice5->hWnd,lpDevice5->wDeviceID);
-
- if (lpDevice5->bPlayAudio)
- PlayWaveFile(lpDevice5->wAudioDeviceID);
-
- lpDevice5->bVideoPlaying=TRUE;
- lpDevice5->bAudioPlaying=TRUE;
-
- //break;
- }
- hOld=wParam;
- }
-
- return TRUE;
- }
-
- if(wParam==lpDevice6->hWnd)
- {
- if (hOld!=wParam)
- {
-
- if(bIsPage1)
- SetCursor(lpDevice6->hCursor);
-
- if (!lpDevice6->bAudioPlaying)
- StopAllWaveFiles();
-
- if(!lpDevice6->bVideoPlaying)
- {
-
- SeekAllToStart();
-
- if (lpDevice6->bPlayVideo)
- PlayVFWFile(hWndMain,lpDevice6->hWnd,lpDevice6->wDeviceID);
-
- if (lpDevice6->bPlayAudio)
- PlayWaveFile(lpDevice6->wAudioDeviceID);
-
- lpDevice6->bVideoPlaying=TRUE;
- lpDevice6->bAudioPlaying=TRUE;
-
-
- //break;
- }
-
- hOld=wParam;
- }
-
- return TRUE;
- }
-
- if(wParam==hWndMain)
- {
- if (hOld!=wParam)
- {
- SeekAllToStart();
- StopAllWaveFiles();
- SetCursor(hHelloCursor);
- hOld=wParam;
- }
-
- return TRUE;
- }
- return FALSE;
- }
-
- /****************************************************************************
-
- FUNCTION : fVgaCapable
-
- PARAMETERS : void
-
- PURPOSE : Determines if the system includes at least a VGA
-
- CALLS : WINDOWS
- GetDC
- GetDeviceCaps
- ReleaseDC
-
- RETURNS : BOOL - TRUE if VGA, FALSE if !VGA
-
- MESSAGES : none
-
- COMMENTS :
-
- HISTORY :
-
- ****************************************************************************/
-
-
- BOOL PASCAL fVgaCapable(void)
- {
- //get screen device context
- HDC hdc = GetDC(NULL);
-
- //is screen res. less then 640 x 480?
- if ((GetDeviceCaps(hdc, HORZRES) != 640) ||
- (GetDeviceCaps(hdc, VERTRES) != 480))
- {
- ReleaseDC(NULL, hdc);
- //if yes, then not VGA
- return FALSE;
- }
- else
- {
- ReleaseDC(NULL, hdc);
- //if no, then VGA
- return TRUE;
- }
- }
-
- /****************************************************************************
-
- FUNCTION : fHiRes
-
- PARAMETERS : void
-
- PURPOSE : Determines if the system is running in at least a 1024 X 768
-
- CALLS : WINDOWS
- GetDC
- GetDeviceCaps
- ReleaseDC
-
- RETURNS : BOOL - TRUE if HiRes, FALSE if !HiRes
-
- MESSAGES : none
-
- COMMENTS :
-
- HISTORY :
-
- ****************************************************************************/
-
-
- BOOL PASCAL fHiResCapable(void)
- {
- //get screen device context
- HDC hdc = GetDC(NULL);
-
- //is screen res. less then 1024 X 768?
- if ((GetDeviceCaps(hdc, HORZRES) < 1024) ||
- (GetDeviceCaps(hdc, VERTRES) < 768))
- {
- ReleaseDC(NULL, hdc);
- //if yes, then not HiRes
- return FALSE;
- }
- else
- {
- ReleaseDC(NULL, hdc);
- //if no, then HiRes
- return TRUE;
- }
- }
-
- /****************************************************************************
-
- FUNCTION : f256Capable
-
- PARAMETERS : void
-
- PURPOSE : determines if the screen dc is capable of at least 8bpp
-
- CALLS : WINDOWS
- GetDC
- GetDeviceCaps
- ReleaseDC
-
- RETURNS : number of wave output devices found
-
- MESSAGES : none
-
- COMMENTS : first checks to see if MMSYSTEM is loaded. So it works
- in 3.0 as well as 3.1
-
- HISTORY :
-
- ****************************************************************************/
-
-
- BOOL PASCAL f256Capable(void)
- {
- //get screen device context
- HDC hdc = GetDC(NULL);
-
- //is the screen dc capable of at least 8bpp?
- if ((GetDeviceCaps(hdc, NUMCOLORS) >= 256) ||
- (GetDeviceCaps(hdc, BITSPIXEL) >= 8))
- {
- ReleaseDC(NULL, hdc);
- //at least 8bpp
- return TRUE;
- }
- else
- {
- ReleaseDC(NULL, hdc);
- //less than 8bpp
- return FALSE;
- }
- }
-
- /****************************************************************************
-
- FUNCTION : fNTRunning
-
- PARAMETERS : void
-
- PURPOSE : determins if application is running under NT.
-
- CALLS : WINDOWS
- GetWinFlags
-
- RETURNS : TRUE if running under NT
-
- MESSAGES : none
-
- COMMENTS :
-
- HISTORY :
-
- ****************************************************************************/
-
-
- BOOL PASCAL fNTRunning(void)
- {
- if (GetWinFlags()&WF_WINNT)
- return TRUE;
- else
- return FALSE;
-
- }