Jump to content
Sign in to follow this  
nacerbaaziz

Request a clarification in a function to play audio files from the compiled script

Recommended Posts

Hello all
I found this function in the Internet
It is to play audio files from  the compiled script
I did not understand just one thing on this function

func play($name, $wait = 0)
local Const $SND_RESOURCE = 0x00040004
local Const $SND_ASYNC = 1
; Play the file - the script will pause as it sounds
if $wait = 0 then
DllCall("winmm.dll", "int", "PlaySound", "str", $name, "hwnd", 0, "int", BitOR($SND_RESOURCE, $SND_ASYNC))
else
DllCall("winmm.dll", "int", "PlaySound", "str", $name, "hwnd", 0, "int", $SND_RESOURCE)
endIf
return 1
endFunc

What I did not understand was this variable

local Const $SND_RESOURCE = 0x00040004

I know that this variable is contains the resource name
But what if I want to change the name of the resource what i'll do?
can i do that?
Thanks in advance

 

Edited by nacerbaaziz

Share this post


Link to post
Share on other sites
4 hours ago, nacerbaaziz said:

I know that this variable is contains the resource name
But what if I want to change the name of the resource what i'll do?
can i do that?

@nacerbaaziz

$SND_RESOURCE does not contain the resource name.  It is a named, magic number, constant that tells the PlaySound function that the value identifying the sound is a resource ID as opposed to an alias or a file name.  Your questions don't seem to be related to AutoIt.  If you want to know more about the Win32 API PlaySound() function, you can start here:

https://msdn.microsoft.com/en-us/library/windows/desktop/dd743680(v=vs.85).aspx

Or

Below is link to the help file for AutoIt's _WinAPI_PlaySound() function, which is a wrapper for the Win32 API PlaySound function.

https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_PlaySound.htm

 

If I'm wrong and your question is related to AutoIt, then please explain what it is, that relates to AutoIt, that you are having trouble understanding.

 

Edited by TheXman

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By nacerbaaziz
      good morning autoit team
      please i need your help
      am trying to make an program that work with hotkeys
      it function is to change the volume to the current application
      e.g when i select the vlc window by using this hotkey i will be able to change the vlc volume with out changing the system volume.
       am able to get the process handle and the process name of the window
      but when am trying to get or set the volume i does not succeded
      i tried to search in this forums but no result.
      can you please guide me to do that.
      am waiting for your answers
      thanks in advanced
    • By v120
      Original posted by CoePSX
       
       
       
       
      Drawing_Script.au3
    • By Skeletor
      Hi All,
      It has been bugging me for a while now. 
      Can you view the AutoIt code from within a compiled exe. Like how you can with most .Net exe's by using a certain program.
      If this is possible, how then can I secure my program (if this method exists).
       
    • By ademon
      Hi. I can open the editor with out problems but I can not compile because it is placed on another partition diferent from C.
      Can you provide an update of this bug?


    • By lenclstr746
      Hi guys,
      Some functions of my script are running slowly. Very slow. What is the reason?
      My Code:
      <snip>
×
×
  • Create New...