Ejemplo n.º 1
0
int __far __cdecl printff(const char *format, ...)
{
va_list argptr;
HANDLE hMemory;
LPSTR pszBuffer;
int len;

va_start(argptr, format);
hMemory = GlobalAlloc(GMEM_MOVEABLE, STDIO_BUF_SIZE);
WinAssert(hMemory);
if (!hMemory)
   {
   return 0;
   }
pszBuffer = (LPSTR)GlobalLock(hMemory);
WinAssert(pszBuffer);
len = wvsprintf(pszBuffer, format, argptr);
va_end(argptr);
WinAssert(strlen(pszBuffer) < STDIO_BUF_SIZE);
if (lpZipUserFunctions && lpZipUserFunctions->print!=NULL)
	len = lpZipUserFunctions->print(pszBuffer, len);
else len=0;
GlobalUnlock(hMemory);
GlobalFree(hMemory);
return len;
}
Ejemplo n.º 2
0
BOOL WINAPI
SoundProc(HWND hwndDlg, WORD wMessage, WPARAM wParam, LPARAM lParam)
{
static HWND hSoundWaveDuring, hSoundWaveAfter, hFileText, hSoundEdit, hPlay, hBrowse;
static UINT uMaxSoundRadioButton; /* upper boundary of uSoundButtonSelected   */

   switch (wMessage) {
   case WM_INITDIALOG:
      if (CanPlayWave())
      {
         hSoundWaveDuring = GetDlgItem(hwndDlg, IDM_SOUND_WAVE_DURING);
         hSoundWaveAfter = GetDlgItem(hwndDlg, IDM_SOUND_WAVE_AFTER);
         hFileText = GetDlgItem(hwndDlg, IDM_SOUND_FILE_TEXT);
         hSoundEdit = GetDlgItem(hwndDlg, IDM_SOUND_EDIT);
         hPlay = GetDlgItem(hwndDlg, IDM_SOUND_PLAY);
         hBrowse = GetDlgItem(hwndDlg, IDM_SOUND_BROWSE);
         EnableWindow(hSoundWaveDuring, TRUE);
         EnableWindow(hSoundWaveAfter, TRUE);
         WinAssert(hFileText);
         EnableWindow(hFileText, TRUE);
         EnableWindow(hSoundEdit, TRUE);
         EnableWindow(hPlay, TRUE);
         EnableWindow(hBrowse, TRUE);
         SetDlgItemText(hwndDlg, IDM_SOUND_EDIT, lpumb->szSoundName);
         uMaxSoundRadioButton = IDM_SOUND_WAVE_AFTER;
      }
      else   /* Can't play wave */
      {
         uMaxSoundRadioButton = IDM_SOUND_BEEP;
      }
      uSoundButtonSelectedTmp = uSoundButtonSelected; /* initialize temp value */
      CheckRadioButton(hwndDlg, IDM_SOUND_NONE, uMaxSoundRadioButton, uSoundButtonSelectedTmp);
//#ifdef NEEDME
      CenterDialog(GetParent(hwndDlg), hwndDlg);
//#endif
      return TRUE;
   case WM_COMMAND:
      switch (LOWORD(wParam)) {
      case IDM_SOUND_NONE:
      case IDM_SOUND_BEEP:
      case IDM_SOUND_WAVE_DURING:
      case IDM_SOUND_WAVE_AFTER:
         uSoundButtonSelectedTmp = LOWORD(wParam);
         CheckRadioButton(hwndDlg, IDM_SOUND_NONE, uMaxSoundRadioButton,
                        uSoundButtonSelectedTmp);
         break;
      case IDM_SOUND_PLAY:
         GetDlgItemText(hwndDlg, IDM_SOUND_EDIT, lpumb->szSoundName, WIZUNZIP_MAX_PATH);
#ifdef __BORLANDC__
#pragma warn -pro
#endif

#ifdef WIN32
      (*lpSndPlaySound)((LPSTR)lpumb->szSoundName, NULL, SND_ASYNC|SND_NOSTOP);
#else
      (*lpSndPlaySound)((LPSTR)lpumb->szSoundName, SND_ASYNC|SND_NOSTOP);
#endif

#ifdef __BORLANDC__
#pragma warn .pro
#endif
         break;
      case IDM_SOUND_BROWSE:
         if (DoOpenFile(hwndDlg, lpumb->szSoundName))
         {
            /* transfer to command window          */
                SetDlgItemText(hwndDlg, IDM_SOUND_EDIT, lpumb->szSoundName);
         }

         break;
       case IDOK:
         uSoundButtonSelected = uSoundButtonSelectedTmp;
         WritePrivateProfileString(szAppName, szSoundOptKey,
            SoundOptsTbl[uSoundButtonSelected-IDM_SOUND_NONE], szWizUnzipIniFile);
         GetDlgItemText(hwndDlg, IDM_SOUND_EDIT, lpumb->szSoundName, WIZUNZIP_MAX_PATH);
         WritePrivateProfileString(szAppName, szSoundNameKey,
                     lpumb->szSoundName,   szWizUnzipIniFile);
         EndDialog(hwndDlg, TRUE);
         break;
      case IDCANCEL:
         /* restore former value of sound file name
          */
         GetPrivateProfileString(szAppName, szSoundNameKey, szDfltWaveFile,
                     lpumb->szSoundName, WIZUNZIP_MAX_PATH,
                     szWizUnzipIniFile);
         EndDialog(hwndDlg, FALSE);
         break;
      case IDM_SOUND_HELP:
            WinHelp(hwndDlg,szHelpFileName,HELP_CONTEXT, (DWORD)(HELPID_SOUND_OPTIONS));
         break;
      }
      return TRUE;
   }
   return FALSE;
}