我正在尝试使用PlaySound,我把
#include <windows.h>
#include <mmsystem.h>
#pragma comment( lib, "Winmm.lib" )
using namespace std;
int main()
{
PlaySound(L"C:\\Users\\iD Student\\Downloads\\HarryPotter.mp3", 0, SND_FILENAME);
}
而不是播放我想要的声音,它播放了一些默认的Windows声音。
答案 0 :(得分:0)
PlaySound不支持.mp3文件。它只支持.wav文件。
这是播放声音的简单代码:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim oWordApp As New Word.Application
Dim oWordMainDoc As Word.Document
Dim docSingle As Word.Document
Dim rngPage As Word.Range
Dim strNewFileName As String = ""
Dim iCurrentPage As Integer, iPageCount As Integer, iLastPage As Integer
oWordMainDoc = oWordApp.Documents.Open(FileName:=TextBox1.Text, [ReadOnly]:=True)
oWordMainDoc.ActiveWindow.View.Type = 3
rngPage = oWordMainDoc.Range
iCurrentPage = 3 'start page
iLastPage = 7 'end page
Dim diff As Integer = iLastPage - iCurrentPage
If iCurrentPage = iPageCount Then
rngPage.End = oWordMainDoc.Range.End
Else
'i think this should define the page range?
oWordApp.Selection.GoTo(1, 1, iCurrentPage + diff)
rngPage.End = oWordApp.Selection.Start
End If
docSingle = oWordApp.Documents.Add
'this doesnt copy the desired pages
rngPage.Copy()
docSingle.Range.PasteAndFormat(19)
docSingle.Range.Find.Execute(FindText:="^m", ReplaceWith:="")
strNewFileName = Replace(oWordMainDoc.FullName, ".doc", "_" & iCurrentPage & "_.doc")
docSingle.SaveAs(strNewFileName)
docSingle.Close()
End Sub