Hallo,
ich versuche gerade auf meinem Board mit Windows Embedded CE 6.0 R2 ein Programm auszuführen, das eine Audiodatei aufnehmen kann.
Hier das Programm:
Dennoch bekomme ich nach den Deployen immer wieder die Meldung: "Application 'meinProgramm.exe' encountered a serious Problem and must shut down".
Was heißt das? hat es mit meiner Applikation zu tun oder eher mit dem Betriebssystem? Danke im Voraus für eure Antworten.
Gruß, Florad
ich versuche gerade auf meinem Board mit Windows Embedded CE 6.0 R2 ein Programm auszuführen, das eine Audiodatei aufnehmen kann.
Hier das Programm:
Code:
#include "stdafx.h"
#include <fstream>
#include <iostream>
#include <windows.h>
using namespace std;
void _tmain(int argc, _TCHAR* argv[])
{
const int NUMPTS = 44100 * 10;
int sampleRate = 44100;
short int waveIn[NUMPTS];
HWAVEIN hWaveIn;
WAVEHDR WaveInHdr;
MMRESULT result;
WAVEFORMATEX pFormat;
pFormat.wFormatTag = WAVE_FORMAT_PCM;
pFormat.nChannels = 1;
pFormat.nSamplesPerSec = sampleRate;
pFormat.nAvgBytesPerSec = 2 * sampleRate;
pFormat.nBlockAlign = 2;
pFormat.wBitsPerSample = 16;
pFormat.cbSize = 0;
result = waveInOpen(&hWaveIn, WAVE_MAPPER, &pFormat, 0, 0, WAVE_FORMAT_DIRECT);
if(result)
{
char fault[256];
cout << "Gerät konnte nicht aktiviert/geöffnet werden" << endl;
}
WaveInHdr.lpData = (LPSTR)waveIn;
WaveInHdr.dwBufferLength = 2 * NUMPTS;
WaveInHdr.dwBytesRecorded = 0;
WaveInHdr.dwUser = 0;
WaveInHdr.dwFlags = 0;
WaveInHdr.dwLoops = 0;
waveInPrepareHeader(hWaveIn, &WaveInHdr, sizeof(WAVEHDR));
result = waveInAddBuffer(hWaveIn, &WaveInHdr, sizeof(WAVEHDR));
if(result)
{
MessageBox(NULL, (LPCWSTR)"Block konnte nicht gelesen werden", NULL, MB_OK | MB_ICONEXCLAMATION);
}
result = waveInStart(hWaveIn);
if(result)
{
MessageBox(NULL, (LPCWSTR)"Aufnehmen unmöglich", NULL, MB_OK | MB_ICONEXCLAMATION);
}
cout << "Aufnehmen..." << endl;
do {
ofstream output("Flashdisk\\test.wav");
output.write(WaveInHdr.lpData, WaveInHdr.dwBytesRecorded);
} while(waveInUnprepareHeader(hWaveIn, &WaveInHdr, sizeof(WAVEHDR)) == WAVERR_STILLPLAYING);
waveInClose(hWaveIn);
}
Dennoch bekomme ich nach den Deployen immer wieder die Meldung: "Application 'meinProgramm.exe' encountered a serious Problem and must shut down".
Was heißt das? hat es mit meiner Applikation zu tun oder eher mit dem Betriebssystem? Danke im Voraus für eure Antworten.
Gruß, Florad