<p>So i have this small tut online that i am copying to Go the best i can.
<a href="http://www.visual-basic-tutorials.com/MicRecord.php" rel="nofollow">http://www.visual-basic-tutorials.com/MicRecord.php</a></p>
<p>I am trying to use Windows own winmm.dll to do this in as few lines of code as i can. When i run i get "exit status 3221225477"
I have no idea what the means, Also i <em>think</em> this should be working as its basically the same as the VB.net version.</p>
<p>Here is the code i have;
package main</p>
<pre><code>import (
"fmt"
"syscall"
"time"
"unsafe"
)
var (
winmm = syscall.MustLoadDLL("winmm.dll")
mciSendString = winmm.MustFindProc("mciSendStringA")
)
func MCIWorker(lpstrCommand string, lpstrReturnString string, uReturnLength int, hwndCallback int) error {
_, _, err := syscall.Syscall(mciSendString.Addr(), uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(lpstrCommand))), uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(lpstrReturnString))), uintptr(uReturnLength), uintptr(hwndCallback))
return err
}
func main() {
fmt.Println("New", MCIWorker("open new Type waveaudio Alias recsound", "", 0, 0))
fmt.Println("Record", MCIWorker("record recsound", "", 0, 0))
time.Sleep(10 * time.Second)
fmt.Println("Save", MCIWorker("save recsound c:\\mic.wav", "", 0, 0))
fmt.Println("Close", MCIWorker("close recsound", "", 0, 0))
}
</code></pre>
<hr/>**评论:**<br/><br/>mortonpe: <pre><p>Checkout <a href="http://stackoverflow.com/questions/10306272/apache-crashing-parent-child-process-exited-with-status-3221225477-restarti" rel="nofollow">http://stackoverflow.com/questions/10306272/apache-crashing-parent-child-process-exited-with-status-3221225477-restarti</a></p>
<p>Summary: something is access memory which is not allocated. Something is up with one of the unsafe address, probably either null, the wrong data type, not sides correctly</p></pre>SaturnsVoid: <pre><p>Thanks i will look into the API a bit more and see if i can work it out.</p></pre>SaturnsVoid: <pre><p>Alright i needed to call it instead, now just trying to figure out how to get it to listen to the default mic...</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传