Jump to content
Sign in to follow this  
poisonkiller

DllCall()

Recommended Posts

poisonkiller

When i rune this script:

DllCall("winmm.dll", "int", "mciSendString", "str", "open somesong.mp3" & " alias playMe", "str", "", "int", 65534, "hwnd", 0)
DllCall("winmm.dll", "int", "mciSendString", "str", "seek playMe to -1", "str", "", "int", 65534, "hwnd", 0)
Do
$mode = DllCall("winmm.dll", "int", "mciSendString", "str", "status playMe mode", "str", "", "int", 65534, "hwnd", 0)
Until $mode[2] = "stopped" or $mode[2] = "paused"

Then comes this error: This program has performed an illegal operation and will be shut down. If the problem persists, contact the program vendor.

What im doing wrong??

Share this post


Link to post
Share on other sites
AutoIT Geek

1st.

"str", "" - are you tring to send NULL ? DLLCALL() dont understand this, use "int", 0

2nd.

"hwnd", 0 - DLLCALL() dont understand this too, try "hwnd", "" or "int", 0

Share this post


Link to post
Share on other sites
poisonkiller

I tryed this now, but its not playing song...

Share this post


Link to post
Share on other sites
odklizec

try this..

; using MCI close before new MCI open is a good practice!
DllCall("winmm.dll", "int", "mciSendString", "str", "close mpegvideo", "str","", "int", 65534, "int", 0)
DllCall("winmm.dll", "int", "mciSendString", "str", "open ""c:\_\audio\file.mp3"" type mpegvideo alias playMe", "str", "", "int", 65534, "int", 0)
DllCall("winmm.dll", "int", "mciSendString", "str", "play playMe from 0", "str", "", "int", 65534, "int", 0)
Do
$mode = DllCall("winmm.dll", "int", "mciSendString", "str", "status playMe mode", "str", "", "int", 65534, "int", 0)
; use small amount of Sleep to make the script less CPU intensive;)
Sleep(100)
Until $mode[2] = "stopped" or $mode[2] = "paused"
Edited by odklizec

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×