none
列出PPC裡的鈴聲 RRS feed

  • 問題

  • 請問有什麼api可以列出PPC內的鈴聲

    例如: system > sounds and notifications, 可以列出內建的鈴聲有哪些

    2007年11月13日 下午 03:30

所有回覆

  • try

    SndGetSoundDirectoriesList or

    SndGetSoundFileList

     

    And an example excerpt from Crossbow document.

    程式碼區塊

    void CopyAndSetRingtone(TCHAR* pszCurrentDirectory, TCHAR* pszFileName)
    {
        TCHAR szPathAndFile[MAX_PATH];
        TCHAR szDestination[MAX_PATH];
        // Initialize an empty SNDFILEINFO structure.
        SNDFILEINFO sndFile               = {0};
        SNDDIRECTORYINFO* pSndDirectories = NULL;
        int cSoundDirectories             = 0;
        // Build the path to the file.
        StringCchPrintf(szPathAndFile, MAX_PATH, _T("%s\\%s"), pszCurrentDirectory, pszFileName);
        // Get the list of User Data directories.
        SndGetSoundDirectoriesList(SND_EVENT_RINGTONELINE1, SND_LOCATION_USERDATA, &pSndDirectories, &cSoundDirectories);
        // Set the destination to the first User Data directory.
        StringCchPrintf(szDestination, MAX_PATH, _T("%s\\%s"), pSndDirectories->szPathName, pszFileName);
        CopyFile(szPathAndFile, szDestination, FALSE);
        // Setup values in the SNDFILEINFO structure.
     only need to set sndFile.szPathName, not sndFile.szDisplayName.
        sndFile.sstType = SND_SOUNDTYPE_FILE;
        StringCchCopy(sndFile.szPathName, MAX_PATH, szDestination);
        // Set the ringtone.
        SndSetSound(SND_EVENT_RINGTONELINE1, &sndFile, TRUE);
        // Free memory.
        LocalFree(pSndDirectories);
        return;
    }

     

     

    2007年11月13日 下午 10:14