Waitrud Weber’s blog

things and reminders for memories

About mmsystem.h : touch or not:

We don't touch this problem, we found already in this program audio-files and could not read them by use of "MCI_OPEN_PARMS ".
Binary atached and we could compile by use of this inclusion.

 

 

int mm_initialization() {
    int result;
    LPSTR buf;
    char temp[512];
    int i;
    int returnvalue = 0;

    buf = (LPSTR)temp;

    if (returnvalue = file_existsA()) return -1;

//    open.lpstrDeviceType = (LPCWSTR)MCI_DEVTYPE_WAVEFORM_AUDIO;
//    open.lpstrElementName = (LPCWSTR)".\\thunder.wav";
//    open.lpstrDeviceType = (LPCWSTR)MCI_DEVTYPE_WAVEFORM_AUDIO;
//    open.lpstrElementName = (LPCWSTR)".\\rain2.wav";
    open.lpstrDeviceType = (LPCSTR)MCI_DEVTYPE_WAVEFORM_AUDIO;
    open.lpstrElementName = (LPCSTR)".\\thunder.wav";
    open.lpstrDeviceType = (LPCSTR)MCI_DEVTYPE_WAVEFORM_AUDIO;
    open.lpstrElementName = (LPCSTR)".\\rain2.wav";

    for (i = 0; i < 10; i++) {
        result = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID | MCI_OPEN_ELEMENT,
            (DWORD_PTR)&open);
        result = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID | MCI_OPEN_ELEMENT,
            (DWORD_PTR)&open3);

        if (result) {
            mciGetErrorStringA(result, (LPSTR)buf, sizeof(buf));
            MessageBoxA(NULL, (LPSTR)buf, NULL, MB_OK);
            if (i >= 9) {
                PostQuitMessage(0);
                return -1;
            }
            Sleep(1000);
        }
    }

    play.dwCallback = (DWORD)hwnd;
    play3.dwCallback = (DWORD)hwnd;

    return 1;
}

//
int file_exists() {
    WIN32_FIND_DATAW FindFileData;
    HANDLE hFind;

    hFind = FindFirstFile( L".\\thunder.wav", &FindFileData );
    if (hFind == INVALID_HANDLE_VALUE) {
        return -1;
    }

    return 0;
}

//
int file_existsA() {
    WIN32_FIND_DATAA FindFileData;
    HANDLE hFind;

    hFind = FindFirstFileA(".\\thunder.wav", &FindFileData);
    if (hFind == INVALID_HANDLE_VALUE) {
        return -1;
    }

    return 0;
}

 

willinglytranslate.blogspot.com