1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62:
| unit Unit5;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, mmsystem, shellapi, jpeg, ExtCtrls, StdCtrls;
implementation
uses Unit3;
{$R *.DFM}
procedure ShellExecute_AndWait(FileName: string; Params: string); var exInfo: TShellExecuteInfo; Ph: DWORD; begin FillChar(exInfo, SizeOf(exInfo), 0); with exInfo do begin cbSize := SizeOf(exInfo); fMask := SEE_MASK_NOCLOSEPROCESS or SEE_MASK_FLAG_DDEWAIT; Wnd := GetActiveWindow(); ExInfo.lpVerb := 'open'; ExInfo.lpParameters := PChar(Params); lpFile := PChar(FileName); nShow := SW_SHOWNORMAL; end; if ShellExecuteEx(@exInfo) then Ph := exInfo.HProcess else begin ShowMessage(SysErrorMessage(GetLastError)); Exit; end; while WaitForSingleObject(ExInfo.hProcess, 50) <> WAIT_OBJECT_0 do Application.ProcessMessages; CloseHandle(Ph); end;
procedure TForm5.Image5Click(Sender: TObject); begin mciSendString('STOP mysound', nil, 0, Handle); mciSendString(pChar('SAVE mySound "'+extractfilepath(application.exename)+edit1.text+'"'),nil,0,Handle); mciSendString('CLOSE mysound', nil, 0, Handle); ShellExecute_AndWait(extractfilepath(application.exename)+'Lame.exe',edit1.text); deletefile(extractfilepath(application.exename)+edit1.text); form5.label1.caption:='Aufnahme wurde gespeichert'; form5.label1.left:=(form5.width-form5.label1.width) div 2; end;
procedure TForm5.Image3Click(Sender: TObject); begin mcisendstring('open new type waveaudio alias mysound', nil, 0, handle); mcisendstring('set mysound time format ms '+'bitspersample 16 '+'Channels 2 '+'samplespersec 44100', nil, 0, handle); mciSendString('RECORD mySound',nil,0,Handle); edit1.visible:=true; form5.label1.caption:='Aufnahme läuft!'; |