Jump to content

Belini

Active Members
  • Posts

    906
  • Joined

  • Last visited

  • Days Won

    2

Reputation Activity

  1. Like
    Belini got a reaction from CYCho in function _mciSendString() of Winmm.dll does not accept directory path with space.   
    @CYCho the quotation marks really solve the problem, but if you use FileGetShortName() even placing quotation marks does not work in this version of winmm.dll which caused the problem.
  2. Like
    Belini reacted to Gianni in function _mciSendString() of Winmm.dll does not accept directory path with space.   
    you could try it like this...
    $sFile = FileGetShortName($sFile)
  3. Like
    Belini reacted to Andreik in function _mciSendString() of Winmm.dll does not accept directory path with space.   
    I did it and it works so you have to figure out your issue or to post a runnable script to replicate the behavior.
  4. Like
    Belini reacted to DutchCoder in Outline in letters using GDI   
    Func _CreateLabel($_text, $_x, $_y, $_w = Default, $_h = Default, $_style = Default, $_fgcol = Default, $_bkcol = 0) Local $_d[4][2] = [[0, -1], [0, 1], [-1, 0], [1, 0]] For $_z = 0 To 3 GUICtrlCreateLabel($_text, $_x + $_d[$_z][0], $_y + $_d[$_z][1], $_w, $_h, $_style) GUICtrlSetColor(-1, $_bkcol) GUICtrlSetBkColor(-1, -2) Next $_label = GUICtrlCreateLabel($_text, $_x, $_y, $_w, $_h, $_style) GUICtrlSetColor(-1, $_fgcol) GUICtrlSetBkColor(-1, -2) Return $_label EndFunc Func _SetLabelData($_handle, $_data) For $_z = 0 To 4 GUICtrlSetData($_handle - $_z, $_data) Next EndFunc Simple solution as replacement for your GUICtrlCreateLabel() and GUICtrlSetData()
  5. Like
    Belini got a reaction from donnyh13 in LibreOffice UDF Help and Support   
    I love Libre-Oficce and this UDF will certainly be very useful!
  6. Thanks
    Belini got a reaction from Shark007 in WebcamDS (DirectShow webcam)   
    The computer I tested is about 5 years old.
    the codec I used was "Xvid MPEG-4" which creates smaller files.
      
    I put everything together in a script, just the UDF made by Frank10 and the other one that you changed to make it easier to compare and thus try to remove the errors that occurred in the UDF that you changed.
  7. Like
    Belini reacted to Nine in show images without using much cpu   
    Here :
    #include <GUIConstants.au3> #include <GDIPlus.au3> #include <File.au3> Opt("MustDeclareVars", True) Example() Func Example() Local $hGUI = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP) GUISetState(@SW_SHOW) Local $aFile = _FileListToArray(".\test", "*.jpg", $FLTA_FILES, True) ;_ArrayDisplay($aFile) _GDIPlus_Startup() Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI), $hImage For $i = 1 To $aFile[0] $hImage = _GDIPlus_ImageLoadFromFile($aFile[$i]) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) _GDIPlus_ImageDispose($hImage) Sleep(30) Next Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Example  
  8. Thanks
    Belini reacted to UEZ in show images without using much cpu   
    I added in the main loop a line to resize the image _WinAPI_StretchBlt:
    ;_WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hGfxDC, 0, 0, $SRCCOPY) _WinAPI_StretchBlt($hDC, 0, 0, @DesktopWidth, @DesktopHeight, $hGfxDC, 0, 0, $iW, $iH, $SRCCOPY) ;resize This should stretch the image to your desktop.
     
    Btw, what is your CPU load now with my example?
  9. Like
    Belini reacted to pixelsearch in OnAutoItExitRegister() in version 3.2.12.1 or earlier   
    @Belini AutoIt 3.2.10.0, help file dated Dec 25, 2007


    Func OnAutoItExit ()...EndFunc
    Defines a user-defined function that will be called when the script exit.

    Func OnAutoItExit ( )
    ...
    EndFunc

    Parameters
    None.

    Remarks
    Inside the function, @ExitCode can be used to retrieve the code set by the exit statement.
    The mode of exit can be retrieved with @ExitMethod.

    0 Natural closing.
    1 close by Exit function.
    2 close by clicking on exit of the systray.
    3 close by user logoff.
    4 close by Windows shutdown.

    Related
    Func OnAutoItStart (), OnExitFunc (Option)

    Example
    Opt("OnExitFunc", "endscript")
    MsgBox(0,"","first statement")

    Func endscript()
    MsgBox(0,"","after last statement " & @EXITMETHOD)
    EndFunc

    Edit: same syntax in Autoit 3.2.12.0 (May 16, 2008)
  10. Like
    Belini reacted to Jos in OnAutoItExitRegister() in version 3.2.12.1 or earlier   
    Open the Helpfile that comes with the version and you will find that you have the syntax all wrong.
    It should be:
    Opt("OnExitFunc", "Encerrar")  
  11. Thanks
    Belini reacted to KaFu in Questions when using LibVLC.au3   
    Looks good for me with this code:
    #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <Constants.au3> #include <WinAPI.au3> Global $gui = GUICreate("Test Mplayer", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOPMOST) GUISetBkColor(0x000000) $hWnd_transp = WinGetHandle("Test Mplayer") _WinAPI_SetWindowLong($hWnd_transp, $GWL_EXSTYLE, $WS_EX_LAYERED) _WinAPI_SetLayeredWindowAttributes($hWnd_transp, 0x000000) $pct_W = (@DesktopWidth * 10) / 100 $pct_H = (@DesktopHeight * 10) / 100 $Player = GUICtrlCreateLabel("", ($pct_W / 2), ($pct_H / 2), @DesktopWidth - $pct_W, @DesktopHeight - $pct_H) GUICtrlSetBkColor($Player, 0x000000) Global $hWnd = GUICtrlGetHandle($Player) GUISetState(@SW_SHOW) Global $file, $s_MPlayer_ARGs_WID = " -wid " & Number($hWnd) & " " Global $aSize = WinGetClientSize($hWnd) $file = "100003.cdg" ; lavfi=filtergraph $i_PID_MPlayer = Run("mplayer.exe -vo directx -slave " & $s_MPlayer_ARGs_WID & " -aspect " & $aSize[0] / $aSize[1] & " -identify -noborder −framedrop -priority abovenormal -lavdopts threads=4 -noslices -colorkey 0 " & $file, @ScriptDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) ; StdinWrite($i_PID_MPlayer, "switch_ratio " & $aSize[0] / $aSize[1] & @LF) Local $b_Playback_Started = False HotKeySet("{esc}", "sair") While 1 Local $StdoutRead_Buffer = "" Local $StdoutRead_Line = "" Do $StdoutRead_Line = StdoutRead($i_PID_MPlayer) $StdoutRead_Buffer &= $StdoutRead_Line If StringInStr($StdoutRead_Buffer, 'Exiting... (End of file)', 2) Then ConsoleWrite('Exiting... (End of file)' & @CRLF) Exit 3 EndIf If StringLen($StdoutRead_Buffer) > 32768 Then ConsoleWrite("! $StdoutRead_Buffer > 32768 characters" & @CRLF) ; Exit EndIf StringReplace($StdoutRead_Buffer, "Too many buffered pts", "") If @extended > 10 Then ConsoleWrite("! Too many buffered pts" & @CRLF) ; Exit EndIf StringReplace($StdoutRead_Buffer, "Unexpected decoder output", "") If @extended > 10 Then ConsoleWrite("! ERROR - Unexpected decoder output" & @CRLF) Exit 4 EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch Until StringInStr($StdoutRead_Buffer, "Starting playback...", 2) Or $b_Playback_Started $b_Playback_Started = True If $StdoutRead_Buffer Then ConsoleWrite($StdoutRead_Buffer) WEnd Func sair() ProcessClose("Mplayer.exe") Exit EndFunc ;==>sair  

  12. Thanks
    Belini reacted to KaFu in Questions when using LibVLC.au3   
    This works fine for me, added some performance related switches to the command-line.
    #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <Constants.au3> Global $gui = GUICreate("Test Mplayer", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOPMOST) Global $hWnd = WinGetHandle("Test Mplayer") GUISetState(@SW_SHOW) Global $s_MPlayer_ARGs_Embed = "-slave -wid " & Number($hWnd) & " " #cs $run_dos_cmd_line = "mplayer.exe -vo directx " & $s_MPlayer_ARGs_Embed & "-identify -msglevel all=5 -lavdopts wait_keyframe -monitorpixelaspect 1 -priority abovenormal -progbar-align 95 -nofs -nodr -double -noslices -font C:\WINDOWS\fonts\verdana.ttf -subfont-autoscale 3 -subfont-osd-scale 4 -subfont-outline 1 -subfont-blur 1 -noautosub -colorkey 0 -input nodefault-bindings -noconsolecontrols -nofontconfig -nomouseinput -nosound -ao null -af volume=-200:0 -osdlevel 3 -lavdopts threads=4 03205.mp4" $i_PID_MPlayer = Run($run_dos_cmd_line, "", @SW_HIDE, $STDERR_MERGED + $STDIN_CHILD) #ce $i_PID_MPlayer = Run("mplayer.exe -vo direct3d " & $s_MPlayer_ARGs_Embed & "-identify -noborder -priority abovenormal -lavdopts threads=4 -noslices test.mov", @ScriptDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) ; StdinWrite($i_PID_MPlayer, "pause" & @LF) ; start MPlayer paused Local $b_Playback_Started = False While 1 Local $StdoutRead_Buffer = "" Local $StdoutRead_Line = "" Do $StdoutRead_Line = StdoutRead($i_PID_MPlayer) $StdoutRead_Buffer &= $StdoutRead_Line If StringInStr($StdoutRead_Buffer, 'Exiting... (End of file)', 2) Then ConsoleWrite('Exiting... (End of file)' & @CRLF) Exit 3 EndIf If StringLen($StdoutRead_Buffer) > 32768 Then ConsoleWrite("! $StdoutRead_Buffer > 32768 characters" & @CRLF) ; Exit EndIf StringReplace($StdoutRead_Buffer, "Too many buffered pts", "") If @extended > 10 Then ConsoleWrite("! Too many buffered pts" & @CRLF) ; Exit EndIf StringReplace($StdoutRead_Buffer, "Unexpected decoder output", "") If @extended > 10 Then ConsoleWrite("! ERROR - Unexpected decoder output" & @CRLF) Exit 4 EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch Until StringInStr($StdoutRead_Buffer, "Starting playback...", 2) Or $b_Playback_Started $b_Playback_Started = True If $StdoutRead_Buffer Then ConsoleWrite($StdoutRead_Buffer) WEnd  
  13. Haha
    Belini reacted to genius257 in Questions when using LibVLC.au3   
    @Belini, yes I'm afraid so.
    Here's a quote from my original libvlc thread:
  14. Thanks
    Belini reacted to Danp2 in Questions when using LibVLC.au3   
    There are some issues with this line --
    $pEndReached = DllCallbackRegister("_VLC_Event_EndReached", "none:cdecl", "handle;handle") The function _VLC_Event_EndReached doesn't exist, so this command fails This callback should be registered once, so this needs to be moved outside of Play().
  15. Like
    Belini got a reaction from genius257 in Questions when using LibVLC.au3   
    I'm using the lib dll that you sent and I've already seen that I'm going to have crashing problems even running just the example you sent because if I let several videos play in a row, it starts to slow down until it crashes, I think that libvlc_media_player_stop() is not cleaning everything it should or so you can't repeat all the commands when putting the next video, I'm doing tests here to try to find out the cause of the crashes.
  16. Like
    Belini got a reaction from genius257 in Questions when using LibVLC.au3   
    @genius257 sorry for posting in my language because my automatic page translator was the one who made it go back to my language when I posted and I didn't realize it because it was in English when I created the topic and as for the functions I think what I need would not be to cut the video but yes fill the whole screen using libvlc_video_set_aspect_ratio() or maybe libvlc_video_set_scale but() I did several tests and I couldn't pass the right parameters using DllCall()
  17. Like
    Belini got a reaction from KaFu in Questions when using LibVLC.au3   
    @Kafu worked perfectly, you really are the man, thanks for this solution.
  18. Like
    Belini reacted to KaFu in Questions when using LibVLC.au3   
    This work for me.
    Sleep(1000) libvlc_video_set_aspect_ratio($hLibVLC_dll, $mp, "16:9") ConsoleWrite(@error & @tab & @extended & @crlf) Sleep(1000) libvlc_video_set_aspect_ratio($hLibVLC_dll, $mp, "4:3") ConsoleWrite(@error & @tab & @extended & @crlf) Sleep(1000) libvlc_video_set_aspect_ratio($hLibVLC_dll, $mp, "16:9") ConsoleWrite(@error & @tab & @extended & @crlf) Sleep(1000) libvlc_video_set_aspect_ratio($hLibVLC_dll, $mp, "1:1") ConsoleWrite(@error & @tab & @extended & @crlf) Sleep(1000) libvlc_video_set_aspect_ratio($hLibVLC_dll, $mp, "211:100") ConsoleWrite(@error & @tab & @extended & @crlf) Sleep(1000) libvlc_video_set_aspect_ratio($hLibVLC_dll, $mp, "") ConsoleWrite(@error & @tab & @extended & @crlf) Func libvlc_video_set_aspect_ratio($hLibVLC_dll, $mp, $asp_ratio) ; // "", "1:1", "4:3", "5:4", 16:9", "16:10", "221:100", "235:100", "239:100" ; https://python-forum.io/thread-17906.html Local $taiData = DllStructCreate("char[32]") DllStructSetData($taiData, 1, $asp_ratio) Local $aRet = DllCall($hLibVLC_dll, "none:cdecl", "libvlc_video_set_aspect_ratio", "handle", $mp, "ptr", DllStructGetPtr($taiData)) If @error <> 0 Then Return SetError(@error, @extended, 0) Return $aRet[0] EndFunc ;==>libvlc_video_set_aspect_ratio  
  19. Like
    Belini got a reaction from pixelsearch in Count number of files in folder..?   
    If you want only the number of files using DirGetSize


    $patch = "C:\Windows\System32\" $test = DirGetSize($patch, 1) MsgBox(4096,'Test', "Number of files found: " & $test[1])
  20. Thanks
    Belini reacted to water in Download old version of Autoit   
    https://www.autoitscript.com/autoit3/files/archive/autoit/
    RunErrorsFatal has been removed with version 3.2.11.0
  21. Like
    Belini got a reaction from Subz in GUI Case, make it start the Case from the beginning   
    @Chantaro welcome to the forum, the problem is that you used the same variable to identify the input and to read its content, use another name to get the link.
    #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $ytdl_path = (@ScriptDir & "\youtube-dl.exe") Global $argsmp3 = (' --extract-audio --format=bestaudio --audio-format mp3 --audio-quality=320k --output "%(title)s.%(ext)s" --cookies .\cookies.txt') Global $argsmp4 = (' --format=bestaudio --output "%(title)s.%(ext)s" --cookies .\cookies.txt') Global $link = "https://youtu.be/HQnC1UHBvWA" #region GUI YoutubeDL() Func YoutubeDL() Local $empty = "" ; Create a GUI with various controls. Local $hGUI = GUICreate("YouTube Downloader", 400, 200, 1000, 500) Local $Label1 = GUICtrlCreateLabel("Insert Youtube link here", 10, 45, 461, 24) GUICtrlSetFont(-1, 10, 200, 0, "Arial") Local $Pic1 = GUICtrlCreatePic(@ScriptDir & "\eXLs5Hw.jpg", 10, 10, 120, 30) Local $video_url = GUICtrlCreateInput($link, 10, 70, 370, 20) Local $idConvertMP3 = GUICtrlCreateButton("Convert to MP3", 10, 100, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $idConvertMP3 $link = GUICtrlRead($video_url) If $link = $empty Then MsgBox(0, "Error", "Please insert a Link") Else ConvertMP3() EndIf EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>YoutubeDL #endregion GUI ;Run Conversion Func ConvertMP3() Run($ytdl_path & " " & $link & $argsmp3) EndFunc ;==>ConvertMP3  
  22. Like
    Belini reacted to TheDcoder in EasyCodeIt - cross-platform AutoIt implementation   
    EasyCodeIt
    A cross-platform implementation of AutoIt
    Introduction:
    EasyCodeIt is an attempt at implementing a programming language which is backward compatible with a sub-set of AutoIt which would work across multiple platforms with many aspects being agnostic to the platform-specific differences.
    Currently the primarily targeted platforms are Linux and Windows, more platforms may be supported in the future as per popular demand. For example it should be easy enough to port to Unix-like platforms such as BSD and Mac with the help of maintainers who are familiar with them.
    The main motivation behind the creation of this project is the lack of a proper easy-to-use scripting language in Linux, while there are numerous scripting languages which natively support it, none of them are as user-friendly and easy to use as AutoIt. (The "Easy" in "EasyCodeIt" reflects this)
    There was a previous thread in which the project was originally started, but it got too big and the discussion is too cluttered and hard to follow for any new readers, here is the thread for those who are interested in reading it:
    Progress:
    Frontend ✅ Tokenizer 🚧 Parser (work in progress) ✅ Expressions 👷‍♂️ Statements (current priority) Backend ⏰ Interpreter (scheduled) I am currently working on expression parsing and syntax tree building.
    --
    This section will be updated in the future with new progress. To stay notified 🔔 follow this thread to get update notifications (by using the "Follow" button on the top-right corner of this page) and 👁️ watch the GitHub repository to get any new activity on your feed.
    Code:
    The code is available on GitHub, please 🌟 star the project if you like it and would like to show your support, it motivates me a lot! (Also don't forget to 👍 Like this post )
    Chat:
    I created a room in Matrix (an open-source federated chat system) for EasyCodeIt, you can join it to chat with me and others who are in the room, it might be a good way to get the latest status updates from me
    You can preview the room without joining, and you don't need to be connected to it 24/7 like IRC. It works a bit like Slack for those who are familiar with it.
    Forum:
    I have created a dedicated forum to post more frequent updates, possibly in their own threads to better organize the discussion. Please sign-up and follow the blog section to get updates. By the way, you can also post pretty much anything there, both technical and non-technical stuff, it is intended to be a hangout for techies but not only for them. So casual discussions, funny cat videos etc. are allowed!
  23. Thanks
    Belini reacted to Nine in $ ES_NUMBER without invalid character message   
    One easy way. Use WM_COMMAND with EN_CHANGE.  Check if the input box contains other char than [0-9] and backspace it.
  24. Thanks
    Belini reacted to Aelc in Show text message over .cdg video   
    #include <GUIConstants.au3> #include <WinApi.au3> #include <array.au3> #include <WindowsConstants.au3> Opt("traymenumode", 1) $aboutitem = TrayCreateItem("About") $Exititem = TrayCreateItem("Exit") $gui = GUICreate("Window", @DesktopWidth, @DesktopHeight, -1, -1, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetState(@SW_SHOW) $gui2 = GUICreate("Window", @DesktopWidth, @DesktopHeight, -1, -1, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetState(@SW_SHOW) $gui3 = GUICreate("Window", @DesktopWidth, @DesktopHeight, -1, -1, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetState(@SW_SHOW) $x = @DesktopWidth / 2 $y = @DesktopHeight / 2 - 60 UpdateTextWindow($gui, "TEXT OVERLAY SCREEN WITH CDG VIDEO and much more text until the dekstop ends :D", 15, 50, "ARIAL BLACK", 1, $x, $y, 0xFF0000) UpdateTextWindow($gui2, "For using second line you have to call it again with another GUI i guess :/ ", 15, 50, "ARIAL BLACK", 1, $x, $y+50, 0xFF0000) UpdateTextWindow($gui3, "else you would have to adjust the SetWindowRgn call through the next call", 15, 50, "ARIAL BLACK", 1, $x, $y+100, 0xFF0000) While 1 $msg = TrayGetMsg() Select Case $msg = $aboutitem MsgBox(64, "About:", "Crosshair v1 " & @CRLF & "Created by Death Pax") Case $msg = $Exititem Exit EndSelect WinSetState($gui, "", @SW_DISABLE) GUISetCursor(16, 1, $gui) WEnd Func UpdateTextWindow($hwnd, $zText, $width, $height, $font = "Lucida Sans Unicode", $weight = 0, $x = 0, $y = 0, $color = -1) Local Const $ANSI_CHARSET = 0 Local Const $OUT_CHARACTER_PRECIS = 2 Local Const $CLIP_DEFAULT_PRECIS = 0 Local Const $PROOF_QUALITY = 2 Local Const $FIXED_PITCH = 1 Local Const $RGN_XOR = 3 If $font = "" Then $font = "Microsoft Sans Serif" If $weight = -1 Then $weight = 1000 If $color <> -1 Then GUISetBkColor($color, $hwnd) Else GUISetBkColor(0xFF0000, $hwnd) EndIf Local $hDC = DllCall("user32.dll", "int", "GetDC", "hwnd", $hwnd) Local $hMyFont = DllCall("gdi32.dll", "hwnd", "CreateFont", "int", $height, _ "int", $width, "int", 0, "int", 0, "int", 1000, "int", 0, _ "int", 0, "int", 0, "int", $ANSI_CHARSET, _ "int", $OUT_CHARACTER_PRECIS, "int", $CLIP_DEFAULT_PRECIS, _ "int", $PROOF_QUALITY, "int", $FIXED_PITCH, "str", $font) Local $hOldFont = DllCall("gdi32.dll", "hwnd", "SelectObject", "int", $hDC[0], _ "hwnd", $hMyFont[0]) DllCall("gdi32.dll", "int", "BeginPath", "int", $hDC[0]) DllCall("gdi32.dll", "int", "TextOut", "int", $hDC[0], "int", 0, "int", 0, _ "str", $zText, "int", StringLen($zText)) DllCall("gdi32.dll", "int", "EndPath", "int", $hDC[0]) Local $hRgn1 = DllCall("gdi32.dll", "hwnd", "PathToRegion", "int", $hDC[0]) Local $rc2 = DllStructCreate("int Left;int Top;int Right;int Bottom") DllCall("gdi32.dll", "int", "GetRgnBox", "hwnd", $hRgn1[0], _ "ptr", DllStructGetPtr($rc2)) Local $hRgn2 = DllCall("gdi32.dll", "hwnd", "CreateRectRgnIndirect", _ "ptr", DllStructGetPtr($rc2)) Local $x_rgn = StringRegExp(DllStructGetData($rc2, 'Right'), "^([-+]?)0*(\d+)$", 1) Local $y_rgn = StringRegExp(DllStructGetData($rc2, 'Left'), "^([-+]?)0*(\d+)$", 1) Local $t = StringRegExp(DllStructGetData($rc2, 'Top'), "^([-+]?)0*(\d+)$", 1) Local $b = StringRegExp(DllStructGetData($rc2, 'Bottom'), "^([-+]?)0*(\d+)$", 1) DllCall("gdi32.dll", "int", "CombineRgn", "hwnd", $hRgn2[0], "hwnd", $hRgn2[0], _ "hwnd", $hRgn1[0], "int", $RGN_XOR) DllCall("gdi32.dll", "int", "DeleteObject", "hwnd", $hRgn1[0]) DllCall('gdi32.dll', 'int', 'OffsetRgn', 'handle', $hRgn2[0], 'int', $x - (($x_rgn[1] - $y_rgn[1]) / 2), 'int', $y - (($t[1]-$b[1])/2)) DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hwnd, "int", $hDC[0]) DllCall("user32.dll", "int", "SetWindowRgn", "hwnd", $hwnd, "hwnd", $hRgn2[0], "int", 1) DllCall("gdi32.dll", "int", "SelectObject", "int", $hDC[0], "hwnd", $hOldFont[0]) EndFunc ;==>UpdateTextWindow Here you go.
    Actually not tested with your cdg, but you can move it like this everywhere on screen  
     
     
    EDIT: updated there was a bug with the $width
  25. Like
    Belini got a reaction from Danyfirex in Control *Application* Sound Volume?   
    I use MixerGetSet.au3 to control the sound of various pc devices.
    $asComponentTypes[0] = "dUndefined" $asComponentTypes[1] = "dDigital" $asComponentTypes[2] = "dLine" $asComponentTypes[3] = "dMonitor" $asComponentTypes[4] = "dSpeakers" $asComponentTypes[5] = "dHeadphones" $asComponentTypes[6] = "dTelephone" $asComponentTypes[7] = "dWave" $asComponentTypes[8] = "dVoice" $asComponentTypes[9] = "sUndefined" $asComponentTypes[10] = "sDigital" $asComponentTypes[11] = "sLine" $asComponentTypes[12] = "sMicrophone" $asComponentTypes[13] = "sSynthesizer" $asComponentTypes[14] = "sCompactDisc" $asComponentTypes[15] = "sTelephone" $asComponentTypes[16] = "sPCSpeaker" $asComponentTypes[17] = "sWave" $asComponentTypes[18] = "sAuxiliary" $asComponentTypes[19] = "sAnalog" #include <GUIConstants.au3> Const $MCA_WMID = 1 Const $MCA_WPID = 2 Const $MCA_VDRIVERVERSION = 3 Const $MCA_SZPNAME = 4 Const $MCA_FDWSUPPORT = 5 Const $MCA_CDESTINATIONS = 6 Const $MCA_STRUCT_DEF = "ushort;ushort;uint;char[32];dword;dword" Const $ML_CBSTRUCT = 1 Const $ML_DWDESTINATION = 2 Const $ML_DWSOURCE = 3 Const $ML_DWLINEID = 4 Const $ML_FDWLINE = 5 Const $ML_DWUSER = 6 Const $ML_DWCOMPONENTTYPE = 7 Const $ML_CCHANNELS = 8 Const $ML_CCONNECTIONS = 9 Const $ML_CCONTROLS = 10 Const $ML_SZSHORTNAME = 11 Const $ML_SZNAME = 12 Const $ML_DWTYPE = 13 Const $ML_DWDEVICEID = 14 Const $ML_WMID = 15 Const $ML_WPID = 16 Const $ML_VDRIVERVERSION = 17 Const $ML_SZPNAME = 18 Const $ML_STRUCT_DEF = "dword;dword;dword;dword;dword;dword;dword;dword;dword;dword;char[16];char[64];dword;dword;ushort;ushort;uint;char[32]" Const $MCO_CBSTRUCT = 1 Const $MCO_DWCONTROLID = 2 Const $MCO_DWCONTROLTYPE = 3 Const $MCO_FDWCONTROL = 4 Const $MCO_CMULTIPLEITEMS = 5 Const $MCO_SZSHORTNAME = 6 Const $MCO_SZNAME = 7 Const $MCO_LMINIMUM = 8 Const $MCO_LMAXIMUM = 9 Const $MCO_DWMINIMUM = 8 Const $MCO_DWMAXIMUM = 9 Const $MCO_DWRESERVED_1 = 10 Const $MCO_CSTEPS = 11 Const $MCO_CBCUSTOMDATA = 11 Const $MCO_DWRESERVED_2 = 12 Const $MCO_STRUCT_DEF = "dword;dword;dword;dword;dword;char[16];char[64];dword;dword;dword[4];dword;dword[5]" Const $MLC_CBSTRUCT = 1 Const $MLC_DWLINEID = 2 Const $MLC_DWCONTROLID = 3 Const $MLC_DWCONTROLTYPE = 3 Const $MLC_CCONTROLS = 4 Const $MLC_CBMXCTRL = 5 Const $MLC_PAMXCTRL = 6 Const $MLC_STRUCT_DEF = "dword;dword;dword;dword;dword;ptr" Const $MCD_CBSTRUCT = 1 Const $MCD_DWCONTROLID = 2 Const $MCD_CCHANNELS = 3 Const $MCD_HWNDOWNER = 4 Const $MCD_CMULTIPLEITEMS = 4 Const $MCD_CBDETAILS = 5 Const $MCD_PADETAILS = 6 Const $MCD_STRUCT_DEF = "dword;dword;dword;dword;dword;ptr" Const $MCDU_DWVALUE = 1 Const $MCDU_STRUCT_DEF = "dword" Const $MIXERLINE_COMPONENTTYPE_DST_FIRST = 0x00000000 Const $MIXERLINE_COMPONENTTYPE_DST_UNDEFINED = $MIXERLINE_COMPONENTTYPE_DST_FIRST + 0 Const $MIXERLINE_COMPONENTTYPE_DST_DIGITAL = $MIXERLINE_COMPONENTTYPE_DST_FIRST + 1 Const $MIXERLINE_COMPONENTTYPE_DST_LINE = $MIXERLINE_COMPONENTTYPE_DST_FIRST + 2 Const $MIXERLINE_COMPONENTTYPE_DST_MONITOR = $MIXERLINE_COMPONENTTYPE_DST_FIRST + 3 Const $MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = $MIXERLINE_COMPONENTTYPE_DST_FIRST + 4 Const $MIXERLINE_COMPONENTTYPE_DST_HEADPHONES = $MIXERLINE_COMPONENTTYPE_DST_FIRST + 5 Const $MIXERLINE_COMPONENTTYPE_DST_TELEPHONE = $MIXERLINE_COMPONENTTYPE_DST_FIRST + 6 Const $MIXERLINE_COMPONENTTYPE_DST_WAVEIN = $MIXERLINE_COMPONENTTYPE_DST_FIRST + 7 Const $MIXERLINE_COMPONENTTYPE_DST_VOICEIN = $MIXERLINE_COMPONENTTYPE_DST_FIRST + 8 Const $MIXERLINE_COMPONENTTYPE_DST_LAST = $MIXERLINE_COMPONENTTYPE_DST_FIRST + 8 Const $MIXERLINE_COMPONENTTYPE_SRC_FIRST = 0x00001000 Const $MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED = $MIXERLINE_COMPONENTTYPE_SRC_FIRST + 0 Const $MIXERLINE_COMPONENTTYPE_SRC_DIGITAL = $MIXERLINE_COMPONENTTYPE_SRC_FIRST + 1 Const $MIXERLINE_COMPONENTTYPE_SRC_LINE = $MIXERLINE_COMPONENTTYPE_SRC_FIRST + 2 Const $MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE = $MIXERLINE_COMPONENTTYPE_SRC_FIRST + 3 Const $MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER = $MIXERLINE_COMPONENTTYPE_SRC_FIRST + 4 Const $MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC = $MIXERLINE_COMPONENTTYPE_SRC_FIRST + 5 Const $MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE = $MIXERLINE_COMPONENTTYPE_SRC_FIRST + 6 Const $MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER = $MIXERLINE_COMPONENTTYPE_SRC_FIRST + 7 Const $MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT = $MIXERLINE_COMPONENTTYPE_SRC_FIRST + 8 Const $MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY = $MIXERLINE_COMPONENTTYPE_SRC_FIRST + 9 Const $MIXERLINE_COMPONENTTYPE_SRC_ANALOG = $MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10 Const $MIXERLINE_COMPONENTTYPE_SRC_LAST = $MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10 Global $aiComponentTypes[20] Global $asComponentTypes[20] $aiComponentTypes[0] = $MIXERLINE_COMPONENTTYPE_DST_UNDEFINED $aiComponentTypes[1] = $MIXERLINE_COMPONENTTYPE_DST_DIGITAL $aiComponentTypes[2] = $MIXERLINE_COMPONENTTYPE_DST_LINE $aiComponentTypes[3] = $MIXERLINE_COMPONENTTYPE_DST_MONITOR $aiComponentTypes[4] = $MIXERLINE_COMPONENTTYPE_DST_SPEAKERS $aiComponentTypes[5] = $MIXERLINE_COMPONENTTYPE_DST_HEADPHONES $aiComponentTypes[6] = $MIXERLINE_COMPONENTTYPE_DST_TELEPHONE $aiComponentTypes[7] = $MIXERLINE_COMPONENTTYPE_DST_WAVEIN $aiComponentTypes[8] = $MIXERLINE_COMPONENTTYPE_DST_VOICEIN $aiComponentTypes[9] = $MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED $aiComponentTypes[10] = $MIXERLINE_COMPONENTTYPE_SRC_DIGITAL $aiComponentTypes[11] = $MIXERLINE_COMPONENTTYPE_SRC_LINE $aiComponentTypes[12] = $MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE $aiComponentTypes[13] = $MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER $aiComponentTypes[14] = $MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC $aiComponentTypes[15] = $MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE $aiComponentTypes[16] = $MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER $aiComponentTypes[17] = $MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT $aiComponentTypes[18] = $MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY $aiComponentTypes[19] = $MIXERLINE_COMPONENTTYPE_SRC_ANALOG $asComponentTypes[0] = "dUndefined" $asComponentTypes[1] = "dDigital" $asComponentTypes[2] = "dLine" $asComponentTypes[3] = "dMonitor" $asComponentTypes[4] = "dSpeakers" $asComponentTypes[5] = "dHeadphones" $asComponentTypes[6] = "dTelephone" $asComponentTypes[7] = "dWave" $asComponentTypes[8] = "dVoice" $asComponentTypes[9] = "sUndefined" $asComponentTypes[10] = "sDigital" $asComponentTypes[11] = "sLine" $asComponentTypes[12] = "sMicrophone" $asComponentTypes[13] = "sSynthesizer" $asComponentTypes[14] = "sCompactDisc" $asComponentTypes[15] = "sTelephone" $asComponentTypes[16] = "sPCSpeaker" $asComponentTypes[17] = "sWave" $asComponentTypes[18] = "sAuxiliary" $asComponentTypes[19] = "sAnalog" Const $MIXERCONTROL_CT_CLASS_CUSTOM = 0x00000000 Const $MIXERCONTROL_CT_CLASS_METER = 0x10000000 Const $MIXERCONTROL_CT_CLASS_SWITCH = 0x20000000 Const $MIXERCONTROL_CT_CLASS_NUMBER = 0x30000000 Const $MIXERCONTROL_CT_CLASS_SLIDER = 0x40000000 Const $MIXERCONTROL_CT_CLASS_FADER = 0x50000000 Const $MIXERCONTROL_CT_CLASS_TIME = 0x60000000 Const $MIXERCONTROL_CT_CLASS_LIST = 0x70000000 Const $MIXERCONTROL_CT_SC_SWITCH_BOOLEAN = 0x00000000 Const $MIXERCONTROL_CT_SC_SWITCH_BUTTON = 0x01000000 Const $MIXERCONTROL_CT_SC_METER_POLLED = 0x00000000 Const $MIXERCONTROL_CT_SC_TIME_MICROSECS = 0x00000000 Const $MIXERCONTROL_CT_SC_TIME_MILLISECS = 0x01000000 Const $MIXERCONTROL_CT_SC_LIST_SINGLE = 0x00000000 Const $MIXERCONTROL_CT_SC_LIST_MULTIPLE = 0x01000000 Const $MIXERCONTROL_CT_UNITS_CUSTOM = 0x00000000 Const $MIXERCONTROL_CT_UNITS_BOOLEAN = 0x00010000 Const $MIXERCONTROL_CT_UNITS_SIGNED = 0x00020000 Const $MIXERCONTROL_CT_UNITS_UNSIGNED = 0x00030000 Const $MIXERCONTROL_CT_UNITS_DECIBELS = 0x00040000 Const $MIXERCONTROL_CT_UNITS_PERCENT = 0x00050000 Const $MIXERCONTROL_CONTROLTYPE_CUSTOM = BitOR($MIXERCONTROL_CT_CLASS_CUSTOM, $MIXERCONTROL_CT_UNITS_CUSTOM) Const $MIXERCONTROL_CONTROLTYPE_BOOLEANMETER = BitOR($MIXERCONTROL_CT_CLASS_METER, $MIXERCONTROL_CT_SC_METER_POLLED, $MIXERCONTROL_CT_UNITS_BOOLEAN) Const $MIXERCONTROL_CONTROLTYPE_SIGNEDMETER = BitOR($MIXERCONTROL_CT_CLASS_METER, $MIXERCONTROL_CT_SC_METER_POLLED, $MIXERCONTROL_CT_UNITS_SIGNED) Const $MIXERCONTROL_CONTROLTYPE_PEAKMETER = $MIXERCONTROL_CONTROLTYPE_SIGNEDMETER + 1 Const $MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER = BitOR($MIXERCONTROL_CT_CLASS_METER, $MIXERCONTROL_CT_SC_METER_POLLED, $MIXERCONTROL_CT_UNITS_UNSIGNED) Const $MIXERCONTROL_CONTROLTYPE_BOOLEAN = BitOR($MIXERCONTROL_CT_CLASS_SWITCH, $MIXERCONTROL_CT_SC_SWITCH_BOOLEAN, $MIXERCONTROL_CT_UNITS_BOOLEAN) Const $MIXERCONTROL_CONTROLTYPE_ONOFF = $MIXERCONTROL_CONTROLTYPE_BOOLEAN + 1 Const $MIXERCONTROL_CONTROLTYPE_MUTE = $MIXERCONTROL_CONTROLTYPE_BOOLEAN + 2 Const $MIXERCONTROL_CONTROLTYPE_MONO = $MIXERCONTROL_CONTROLTYPE_BOOLEAN + 3 Const $MIXERCONTROL_CONTROLTYPE_LOUDNESS = $MIXERCONTROL_CONTROLTYPE_BOOLEAN + 4 Const $MIXERCONTROL_CONTROLTYPE_STEREOENH = $MIXERCONTROL_CONTROLTYPE_BOOLEAN + 5 Const $MIXERCONTROL_CONTROLTYPE_BUTTON = BitOR($MIXERCONTROL_CT_CLASS_SWITCH, $MIXERCONTROL_CT_SC_SWITCH_BUTTON, $MIXERCONTROL_CT_UNITS_BOOLEAN) Const $MIXERCONTROL_CONTROLTYPE_DECIBELS = BitOR($MIXERCONTROL_CT_CLASS_NUMBER, $MIXERCONTROL_CT_UNITS_DECIBELS) Const $MIXERCONTROL_CONTROLTYPE_SIGNED = BitOR($MIXERCONTROL_CT_CLASS_NUMBER, $MIXERCONTROL_CT_UNITS_SIGNED) Const $MIXERCONTROL_CONTROLTYPE_UNSIGNED = BitOR($MIXERCONTROL_CT_CLASS_NUMBER, $MIXERCONTROL_CT_UNITS_UNSIGNED) Const $MIXERCONTROL_CONTROLTYPE_PERCENT = BitOR($MIXERCONTROL_CT_CLASS_NUMBER, $MIXERCONTROL_CT_UNITS_PERCENT) Const $MIXERCONTROL_CONTROLTYPE_SLIDER = BitOR($MIXERCONTROL_CT_CLASS_SLIDER, $MIXERCONTROL_CT_UNITS_SIGNED) Const $MIXERCONTROL_CONTROLTYPE_PAN = $MIXERCONTROL_CONTROLTYPE_SLIDER + 1 Const $MIXERCONTROL_CONTROLTYPE_QSOUNDPAN = $MIXERCONTROL_CONTROLTYPE_SLIDER + 2 Const $MIXERCONTROL_CONTROLTYPE_FADER = BitOR($MIXERCONTROL_CT_CLASS_FADER, $MIXERCONTROL_CT_UNITS_UNSIGNED) Const $MIXERCONTROL_CONTROLTYPE_VOLUME = $MIXERCONTROL_CONTROLTYPE_FADER + 1 Const $MIXERCONTROL_CONTROLTYPE_BASS = $MIXERCONTROL_CONTROLTYPE_FADER + 2 Const $MIXERCONTROL_CONTROLTYPE_TREBLE = $MIXERCONTROL_CONTROLTYPE_FADER + 3 Const $MIXERCONTROL_CONTROLTYPE_EQUALIZER = $MIXERCONTROL_CONTROLTYPE_FADER + 4 Const $MIXERCONTROL_CONTROLTYPE_SINGLESELECT = BitOR($MIXERCONTROL_CT_CLASS_LIST, $MIXERCONTROL_CT_SC_LIST_SINGLE, $MIXERCONTROL_CT_UNITS_BOOLEAN) Const $MIXERCONTROL_CONTROLTYPE_MUX = $MIXERCONTROL_CONTROLTYPE_SINGLESELECT + 1 Const $MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT = BitOR($MIXERCONTROL_CT_CLASS_LIST, $MIXERCONTROL_CT_SC_LIST_MULTIPLE, $MIXERCONTROL_CT_UNITS_BOOLEAN) Const $MIXERCONTROL_CONTROLTYPE_MIXER = $MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT + 1 Const $MIXERCONTROL_CONTROLTYPE_MICROTIME = BitOR($MIXERCONTROL_CT_CLASS_TIME, $MIXERCONTROL_CT_SC_TIME_MICROSECS, $MIXERCONTROL_CT_UNITS_UNSIGNED) Const $MIXERCONTROL_CONTROLTYPE_MILLITIME = BitOR($MIXERCONTROL_CT_CLASS_TIME, $MIXERCONTROL_CT_SC_TIME_MILLISECS, $MIXERCONTROL_CT_UNITS_UNSIGNED) Global $aiControlTypes[30] Global $asControlTypes[30] $aiControlTypes[0] = $MIXERCONTROL_CONTROLTYPE_CUSTOM $aiControlTypes[1] = $MIXERCONTROL_CONTROLTYPE_BOOLEANMETER $aiControlTypes[2] = $MIXERCONTROL_CONTROLTYPE_SIGNEDMETER $aiControlTypes[3] = $MIXERCONTROL_CONTROLTYPE_PEAKMETER $aiControlTypes[4] = $MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER $aiControlTypes[5] = $MIXERCONTROL_CONTROLTYPE_BOOLEAN $aiControlTypes[6] = $MIXERCONTROL_CONTROLTYPE_ONOFF $aiControlTypes[7] = $MIXERCONTROL_CONTROLTYPE_MUTE $aiControlTypes[8] = $MIXERCONTROL_CONTROLTYPE_MONO $aiControlTypes[9] = $MIXERCONTROL_CONTROLTYPE_LOUDNESS $aiControlTypes[10] = $MIXERCONTROL_CONTROLTYPE_STEREOENH $aiControlTypes[11] = $MIXERCONTROL_CONTROLTYPE_BUTTON $aiControlTypes[12] = $MIXERCONTROL_CONTROLTYPE_DECIBELS $aiControlTypes[13] = $MIXERCONTROL_CONTROLTYPE_SIGNED $aiControlTypes[14] = $MIXERCONTROL_CONTROLTYPE_UNSIGNED $aiControlTypes[15] = $MIXERCONTROL_CONTROLTYPE_PERCENT $aiControlTypes[16] = $MIXERCONTROL_CONTROLTYPE_SLIDER $aiControlTypes[17] = $MIXERCONTROL_CONTROLTYPE_PAN $aiControlTypes[18] = $MIXERCONTROL_CONTROLTYPE_QSOUNDPAN $aiControlTypes[19] = $MIXERCONTROL_CONTROLTYPE_FADER $aiControlTypes[20] = $MIXERCONTROL_CONTROLTYPE_VOLUME $aiControlTypes[21] = $MIXERCONTROL_CONTROLTYPE_BASS $aiControlTypes[22] = $MIXERCONTROL_CONTROLTYPE_TREBLE $aiControlTypes[23] = $MIXERCONTROL_CONTROLTYPE_EQUALIZER $aiControlTypes[24] = $MIXERCONTROL_CONTROLTYPE_SINGLESELECT $aiControlTypes[25] = $MIXERCONTROL_CONTROLTYPE_MUX $aiControlTypes[26] = $MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT $aiControlTypes[27] = $MIXERCONTROL_CONTROLTYPE_MIXER $aiControlTypes[28] = $MIXERCONTROL_CONTROLTYPE_MICROTIME $aiControlTypes[29] = $MIXERCONTROL_CONTROLTYPE_MILLITIME $asControlTypes[0] = "Custom" $asControlTypes[1] = "BooleanMeter" $asControlTypes[2] = "SignedMeter" $asControlTypes[3] = "PeakMeter" $asControlTypes[4] = "UnsignedMeter" $asControlTypes[5] = "Boolean" $asControlTypes[6] = "OnOff" $asControlTypes[7] = "Mute" $asControlTypes[8] = "Mono" $asControlTypes[9] = "Loudness" $asControlTypes[10] = "StereoEnh" $asControlTypes[11] = "Button" $asControlTypes[12] = "Decibels" $asControlTypes[13] = "Signed" $asControlTypes[14] = "Unsigned" $asControlTypes[15] = "Percent" $asControlTypes[16] = "Slider" $asControlTypes[17] = "Pan" $asControlTypes[18] = "QSoundPan" $asControlTypes[19] = "Fader" $asControlTypes[20] = "Volume" $asControlTypes[21] = "Bass" $asControlTypes[22] = "Treble" $asControlTypes[23] = "Equalizer" $asControlTypes[24] = "SingleSelect" $asControlTypes[25] = "Mux" $asControlTypes[26] = "MultipleSelect" $asControlTypes[27] = "Mixer" $asControlTypes[28] = "Microtime" $asControlTypes[29] = "Millitime" Const $MIXER_GETLINEINFOF_DESTINATION = 0x00000000 Const $MIXER_GETLINEINFOF_SOURCE = 0x00000001 Const $MIXER_GETLINEINFOF_LINEID = 0x00000002 Const $MIXER_GETLINEINFOF_COMPONENTTYPE = 0x00000003 Const $MIXER_GETLINEINFOF_TARGETTYPE = 0x00000004 Const $MIXER_GETLINECONTROLSF_ALL = 0x00000000 Const $MIXER_GETLINECONTROLSF_ONEBYID = 0x00000001 Const $MIXER_GETLINECONTROLSF_ONEBYTYPE = 0x00000002 Const $MIXER_GETCONTROLDETAILSF_VALUE = 0x00000000 Const $MIXER_GETCONTROLDETAILSF_LISTTEXT = 0x00000001 Const $MIXER_SETCONTROLDETAILSF_VALUE = 0x00000000 Const $MIXER_SETCONTROLDETAILSF_CUSTOM = 0x00000001 ; ================================================================================= EXEMPLO _MixerSet("dSpeakers", "volume", 0); <======== Baixa os alto falantes Sleep(1000) _MixerSet("dSpeakers", "volume", 100); <======== Aumenta os alto falantes Sleep(1000) _MixerSet("sWave", "volume", 0); <======== Baixa o som wave Sleep(1000) _MixerSet("sWave", "volume", 100); <======== Aumenta o som wave ; ================================================================================= EXEMPLO ;CÓDIGOS DE ERRO RETORNADOS ; 1 - ID do Mixer é inválido ; 2 - tipo de componente inválido ; 3 - instancia de componente invalida ; 4 - tipo de Controle inválido ; 5 - Não é possível abrir o Mixer especificado ; 6 - Mixer não suporta o componente especificado ; 7 - Mixer não tem o tipo de componente especificado ; 8 - componente não suporta o tipo de controle especificado ; 9 - Não é possível obter a configuração atual ; 10 - Não é possível alterar a configuração ;---------------------------------------------------------- ; ; Nome: _MixerGet ; Descrição: Retorna o valor do controle solicitado ; Sintese _MixerGet($sComponentType, $sControlType) ; Parametros: ; $sComponentType - Nome do componente ; ; - dUndefined ; - dDigital ; - dLine ; - dMonitor ; - dSpeakers ; - dHeadphones ; - dTelephone ; - dWave ; - dVoice ; - sUndefined ; - sDigital ; - sLine ; - sMicrophone ; - sSynthesizer ; - sCompactDisc ; - sTelephone ; - sPCSpeaker ; - sWave ; - sAuxiliary ; - sAnalog ; ; $sControlType - Tipo de Controle ; ; - Custom ; - BooleanMeter ; - SignedMeter ; - PeakMeter ; - UnsignedMeter ; - Boolean ; - OnOff ; - Mute ; - Mono ; - Loudness ; - StereoEnh ; - Button ; - Decibels ; - Signed ; - Unsigned ; - Percent ; - Slider ; - Pan ; - QSoundPan ; - Fader ; - Volume ; - Bass ; - Treble ; - Equalizer ; - SingleSelect ; - Mux ; - MultipleSelect ; - Mixer ; - Microtime ; - Millitime ; ; Valor Retornado: Sucesso - retorna @error = 0 e o valor do controle acessado ; caixa de seleção retorna 0 or 1. ; ; Falha - Retorna 0 e código do @error : ; ; 1 - ID do Mixer é inválido ; 2 - tipo de componente inválido ; 3 - instancia de componente invalida ; 4 - tipo de Controle inválido ; 5 - Não é possível abrir o Mixer especificado ; 6 - Mixer não suporta o componente especificado ; 7 - Mixer não tem o tipo de componente especificado ; 8 - componente não suporta o tipo de controle especificado ; 9 - Não é possível obter a configuração atual ; 10 - Não é possível alterar a configuração ; ; ; ;------------------------------------------------------------- Func _MixerGet($sComponentType, $sControlType) $iMixerID = 0 $iComponentInstance = 1 Local $iRet = MixerSetGet($iMixerID, $sComponentType, $iComponentInstance, $sControlType, False, 0) SetError(@error) Return $iRet EndFunc ;==>_MixerGet ;---------------------------- ; ; Nome: _MixerSet ; Descrição: Grava o valor no controle especificado ; ; Síntese: _MixerSet($sComponentType, $sControlType, $iNewParamValue) ; ; Parametros: $sComponentType = Nome do componente (os mesmos da lista de _MixerGet) ; ; $sControlType - Tipo de Controle (os mesmos da lista de _MixerGet) ; ; ; ; $iNewParamValue = Novo valor ; Para controles (caixa de seleção) zero é igual Off e 1 é igual On. ; Para outros controles este é um percentual de 0 a 100 ; ; Valores Retornados: Successo Retorna @error = 0 e o valor fixado no controle ; ; Falha - Retorna 0 e código do @error (os mesmos da lista de _MixerGet) ; ;----------------------------------------------------------------------------------------------- Func _MixerSet($sComponentType, $sControlType, $iNewParamValue) $iMixerID = 0 $iComponentInstance = 1 Local $iRet = MixerSetGet($iMixerID, $sComponentType, $iComponentInstance, $sControlType, True, $iNewParamValue) SetError(@error) Return $iRet EndFunc ;==>_MixerSet ; Funções Internas Func MixerOpen(ByRef $hMixer, $iMixerID, $hCallback, $iInstance, $iFlags) Local $hStruct = DllStructCreate("ptr") Local $iRet = DllCall("winmm.dll", "uint", "mixerOpen", "ptr", DllStructGetPtr($hStruct), "uint", $iMixerID, "dword", $hCallback, "dword", $iInstance, "dword", $iFlags) If @error Or $iRet[0] Then Return False Else $hMixer = DllStructGetData($hStruct, 1) Return True EndIf EndFunc ;==>MixerOpen Func MixerClose($hMixer) Local $iRet = DllCall("winmm.dll", "uint", "mixerClose", "uint", $hMixer) If @error Or $iRet[0] Then Return False Else Return True EndIf EndFunc ;==>MixerClose Func MixerGetDevCaps($hMixer, ByRef $hMxCaps) Local $iRet = DllCall("winmm.dll", "uint", "mixerGetDevCaps", "uint", $hMixer, "ptr", DllStructGetPtr($hMxCaps), "uint", DllStructGetSize($hMxCaps)) If @error Or $iRet[0] Then Return False Else Return True EndIf EndFunc ;==>MixerGetDevCaps Func MixerGetLineInfo($hMixer, ByRef $hMxLine, $iFlags) DllStructSetData($hMxLine, $ML_CBSTRUCT, DllStructGetSize($hMxLine)) Local $iRet = DllCall("winmm.dll", "uint", "mixerGetLineInfo", "uint", $hMixer, "ptr", DllStructGetPtr($hMxLine), "dword", $iFlags) If @error Or $iRet[0] Then Return False Else Return True EndIf EndFunc ;==>MixerGetLineInfo Func MixerGetLineControls($hMixer, ByRef $hMxLineCtrls, $iFlags) DllStructSetData($hMxLineCtrls, $MLC_CBSTRUCT, DllStructGetSize($hMxLineCtrls)) Local $iRet = DllCall("winmm.dll", "uint", "mixerGetLineControls", "uint", $hMixer, "ptr", DllStructGetPtr($hMxLineCtrls), "dword", $iFlags) If @error Or $iRet[0] Then Return False Else Return True EndIf EndFunc ;==>MixerGetLineControls Func MixerGetControlDetails($hMixer, ByRef $hMxCtrlDetails, $iFlags) DllStructSetData($hMxCtrlDetails, $MCD_CBSTRUCT, DllStructGetSize($hMxCtrlDetails)) Local $iRet = DllCall("winmm.dll", "uint", "mixerGetControlDetails", "uint", $hMixer, "ptr", DllStructGetPtr($hMxCtrlDetails), "dword", $iFlags) If @error Or $iRet[0] Then Return False Else Return True EndIf EndFunc ;==>MixerGetControlDetails Func MixerSetControlDetails($hMixer, ByRef $hMxCtrlDetails, $iFlags) DllStructSetData($hMxCtrlDetails, $MCD_CBSTRUCT, DllStructGetSize($hMxCtrlDetails)) Local $iRet = DllCall("winmm.dll", "uint", "mixerSetControlDetails", "uint", $hMixer, "ptr", DllStructGetPtr($hMxCtrlDetails), "dword", $iFlags) If @error Or $iRet[0] Then Return False Else Return True EndIf EndFunc ;==>MixerSetControlDetails Func MixerSetGet($iMixerID, $sComponentType, $iComponentInstance, $sControlType, $fIsSet, $iNewParamValue) ;verifica Id If Not IsInt($iMixerID) Or $iMixerID < 0 Then SetError(1) Return 0 EndIf ;determina o tipo de componente Local $iComponentType = -1 For $iIndex = 0 To UBound($asComponentTypes) - 1 If StringCompare($sComponentType, $asComponentTypes[$iIndex]) = 0 Then $iComponentType = $aiComponentTypes[$iIndex] ExitLoop EndIf Next ; verifica tipo de componente If $iComponentType = -1 Then SetError(2) Return 0 EndIf ; verifica instância do componente If Not IsInt($iComponentInstance) Or $iComponentInstance <= 0 Then SetError(3) Return 0 EndIf ; Determina o tipo de controle Local $iControlType = -1 For $iIndex = 0 To UBound($asControlTypes) - 1 If StringCompare($sControlType, $asControlTypes[$iIndex]) = 0 Then $iControlType = $aiControlTypes[$iIndex] ExitLoop EndIf Next If $iControlType = -1 Then SetError(4) Return 0 EndIf ;abre o Mixer especificado Local $hMixer If Not MixerOpen($hMixer, $iMixerID, 0, 0, 0) Then SetError(5) Return 0 EndIf Local $iDestCount Local $hMxCaps = DllStructCreate($MCA_STRUCT_DEF) If MixerGetDevCaps($hMixer, $hMxCaps) Then $iDestCount = DllStructGetData($hMxCaps, $MCA_CDESTINATIONS) Else $iDestCount = 1 EndIf Local $hMxLine = DllStructCreate($ML_STRUCT_DEF) If $iComponentInstance = 1 Then DllStructSetData($hMxLine, $ML_DWCOMPONENTTYPE, $iComponentType) If Not MixerGetLineInfo($hMixer, $hMxLine, $MIXER_GETLINEINFOF_COMPONENTTYPE) Then MixerClose($hMixer) SetError(6) Return 0 EndIf Else Local $fFound = False Local $iCurDest = 0 Local $iInstanceFound = 0 While $iCurDest < $iDestCount And Not $fFound DllStructSetData($hMxLine, $ML_DWDESTINATION, $iCurDest) If Not MixerGetLineInfo($hMixer, $hMxLine, $MIXER_GETLINEINFOF_DESTINATION) Then $iCurDest = $iCurDest + 1 ContinueLoop EndIf Local $iSrcCount = DllStructGetData($hMxLine, $ML_CCONNECTIONS) Local $iCurSrc = 0 While $iCurSrc < $iSrcCount And Not $fFound DllStructSetData($hMxLine, $ML_DWDESTINATION, $iCurDest) DllStructSetData($hMxLine, $ML_DWSOURCE, $iCurSrc) If Not MixerGetLineInfo($hMixer, $hMxLine, $MIXER_GETLINEINFOF_SOURCE) Then $iCurSrc = $iCurSrc + 1 ContinueLoop EndIf If DllStructGetData($hMxLine, $ML_DWCOMPONENTTYPE) = $iComponentType Then $iInstanceFound = $iInstanceFound + 1 If $iInstanceFound = $iComponentInstance Then $fFound = True EndIf EndIf $iCurSrc = $iCurSrc + 1 WEnd $iCurDest = $iCurDest + 1 WEnd If Not $fFound Then MixerClose($hMixer) SetError(7) Return 0 EndIf EndIf Local $hMxLineCtrls = DllStructCreate($MLC_STRUCT_DEF) Local $hMxCtrl = DllStructCreate($MCO_STRUCT_DEF) DllStructSetData($hMxLineCtrls, $MLC_CBSTRUCT, DllStructGetSize($hMxLineCtrls)) DllStructSetData($hMxLineCtrls, $MLC_DWLINEID, DllStructGetData($hMxLine, $ML_DWLINEID)) DllStructSetData($hMxLineCtrls, $MLC_DWCONTROLTYPE, $iControlType) DllStructSetData($hMxLineCtrls, $MLC_CCONTROLS, 1) DllStructSetData($hMxLineCtrls, $MLC_CBMXCTRL, DllStructGetSize($hMxCtrl)) DllStructSetData($hMxLineCtrls, $MLC_PAMXCTRL, DllStructGetPtr($hMxCtrl)) If Not MixerGetLineControls($hMixer, $hMxLineCtrls, $MIXER_GETLINECONTROLSF_ONEBYTYPE) Then MixerClose($hMixer) SetError(8) Return 0 EndIf Local $iMin = DllStructGetData($hMxCtrl, $MCO_DWMINIMUM) Local $iMax = DllStructGetData($hMxCtrl, $MCO_DWMAXIMUM) Local $fControlTypeIsBoolean Switch $iControlType Case $MIXERCONTROL_CONTROLTYPE_ONOFF $fControlTypeIsBoolean = True Case $MIXERCONTROL_CONTROLTYPE_MUTE $fControlTypeIsBoolean = True Case $MIXERCONTROL_CONTROLTYPE_MONO $fControlTypeIsBoolean = True Case $MIXERCONTROL_CONTROLTYPE_LOUDNESS $fControlTypeIsBoolean = True Case $MIXERCONTROL_CONTROLTYPE_STEREOENH $fControlTypeIsBoolean = True Case Else $fControlTypeIsBoolean = False EndSwitch Local $fAdjustCurrentSettings = False If $fIsSet And (StringLeft($iNewParamValue, 1) = "+" Or StringLeft($iNewParamValue, 1) = "-") Then $fAdjustCurrentSettings = True EndIf Local $hMxCtrlDetails = DllStructCreate($MCD_STRUCT_DEF) Local $hMxCtrlValue = DllStructCreate($MCDU_STRUCT_DEF) DllStructSetData($hMxCtrlDetails, $MCD_CBSTRUCT, DllStructGetSize($hMxCtrlDetails)) DllStructSetData($hMxCtrlDetails, $MCD_DWCONTROLID, DllStructGetData($hMxCtrl, $MCO_DWCONTROLID)) DllStructSetData($hMxCtrlDetails, $MCD_CCHANNELS, 1) DllStructSetData($hMxCtrlDetails, $MCD_CBDETAILS, DllStructGetSize($hMxCtrlValue)) DllStructSetData($hMxCtrlDetails, $MCD_PADETAILS, DllStructGetPtr($hMxCtrlValue)) Local $iCurValue = 0 If $fAdjustCurrentSettings Then If Not MixerGetControlDetails($hMixer, $hMxCtrlDetails, $MIXER_GETCONTROLDETAILSF_VALUE) Then MixerClose($hMixer) SetError(9) Return 0 EndIf $iCurValue = DllStructGetData($hMxCtrlValue, $MCDU_DWVALUE) EndIf If $fIsSet Then If $fControlTypeIsBoolean Then If $fAdjustCurrentSettings Then If $iCurValue > $iMin Then DllStructSetData($hMxCtrlValue, $MCDU_DWVALUE, $iMin) Else DllStructSetData($hMxCtrlValue, $MCDU_DWVALUE, $iMax) EndIf Else If $iNewParamValue > 0 Then DllStructSetData($hMxCtrlValue, $MCDU_DWVALUE, $iMax) Else DllStructSetData($hMxCtrlValue, $MCDU_DWVALUE, $iMin) EndIf EndIf Else Local $iNewActualValue = ($iMax - $iMin) * ($iNewParamValue / 100.0) If $fAdjustCurrentSettings Then $iNewActualValue = $iNewActualValue + $iCurValue EndIf If $iNewActualValue < $iMin Then $iNewActualValue = $iMin ElseIf $iNewActualValue > $iMax Then $iNewActualValue = $iMax EndIf DllStructSetData($hMxCtrlValue, $MCDU_DWVALUE, $iNewActualValue) EndIf If Not MixerSetControlDetails($hMixer, $hMxCtrlDetails, $MIXER_SETCONTROLDETAILSF_VALUE) Then MixerClose($hMixer) SetError(10) Return 0 EndIf EndIf If Not MixerGetControlDetails($hMixer, $hMxCtrlDetails, $MIXER_GETCONTROLDETAILSF_VALUE) Then MixerClose($hMixer) SetError(9) Return 0 EndIf $iCurValue = DllStructGetData($hMxCtrlValue, $MCDU_DWVALUE) MixerClose($hMixer) SetError(0) If $fControlTypeIsBoolean Then If $iCurValue Then Return 1 Else Return 0 EndIf Else Return Round(100.0 * ($iCurValue - $iMin) / ($iMax - $iMin), 2) EndIf EndFunc ;==>MixerSetGet Note: I no longer remember where I got it and I also don't know the author's name.
×
×
  • Create New...