Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/09/2024 in all areas

  1. Fritterandwaste

    Midi UDF

    Actually I think my problems are now resolved. Thank you once again.
    1 point
  2. Haha...thx, i made this centuries ago...if I remember right, it was a contribution to some other "digital desktop clock" scripts which took some hundret lines of code...my intention was to write a script in less than 50 lines of code. The "bitbanging" aka producing a polygon, means the position and orientation of an "equal shape", I taught myself about 40 years ago when I programmed "graphical" games for a calculator (sharp PC1401) with a 7-segment LC display in machine code. yepp, rotation is the key...and it is not necessary to use "graphical stuff" like GDI(+) or something like that to read or write "pixels"! A bitmap is an array of bytes/words/dwords representing the "pixels". If you put an AutoIt dllstruct "over" a bitmap (at the bitmap's starting address in memory), you can read or write "pixels" with a simple DllStructGetData() / DllStructSetData(), or, much faster, define/read the dllstruct as a "string" (characters) and use the super-fast AutoIt string commands like StringInstr() to locate a specific sequence of "bytes" (characters). As Werty mentioned, the first column of the digit is unique. This requires seven "bit tests" due to the way the pixels are arranged in memory, as each "pixel" is in a different area of the bitmap. After rotating the image, only one test is required, as the "pixels" of the first column are now in a row, one after the other. So only one read from memory is required to get the "number". And since the position of the next "number" on the screen is known in the bitmap's memory, a search for a sequence of 4 consecutive "numbers" would only require 4 reads from memory. This means that the first step is to look for the first "digit", then look at the (known) next position in memory and check if the byte at that position is the second "digit", and so on... With this technique the search of a sequence of "numbers" on a screenshot is possible in a few (milli)-Seconds. In native AutoIt code....
    1 point
  3. All together ? Like this : #include <File.au3> #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- Global $_MasterEdlFile = "" ; This global variable is always to be enabled!! Global $_sMasterType1Edl = "Type1.edl" Global $_sMasterType2Edl = "Type2.edl" Global $_sMasterType3Edl = "Type3.edl" Global $_sMasterType4Edl = "Type4.edl" ; Global $_sTypeSetName = "" ; Disable when any of the other variables are deployed Global $_sTypeSetName = "F:\Audio\Type_1" ; Global $_sTypeSetName = "F:\Audio\Type_2" ; Global $_sTypeSetName = "F:\Audio\Type_3" ; Global $_sTypeSetName = "F:\Audio\Type_4" ; ----------------------------------------------- _CreateTypeData($_sTypeSetName) ; ----------------------------------------------- Func _CreateTypeData($_sTypeSetName) Local $_ConfirmCreate = MsgBox($MB_YESNO, "NOTICE!", "Create " & StringMid($_sTypeSetName, 10, 6) & " Session Data from .wav data?") ; ------------------------------------------------------ If $_ConfirmCreate = $IDYES Then Local $_WavFiles = _FileOpenDialog() Local $_DestFolder = _FileSelectFolder() Local $_sWavFolder = $_WavFiles[1] ; contains only a path, no matter the user selected 1 or more files ; ------------------------------------------------------ For $i = 2 To $_WavFiles[0] ; 1st file name in element 2 etc... Local $_WavFileName = $_sWavFolder & "\" & $_WavFiles[$i] Local $_WavBaseName = StringTrimRight($_WavFiles[$i], 4) ; ----------------- Local $_NewEdlFile = $_DestFolder & "\" & $_WavBaseName & ".edl" ; ----------------- FileCopy($_MasterEdlFile, $_NewEdlFile, $FC_NOOVERWRITE) Next ; ----------------- MsgBox($MB_ICONINFORMATION, "Success", "The " & StringMid($_sTypeSetName, 10, 6) & " file(s) have been created successfully.") ; ------------------------------------------------------ Else ; $IDNO MsgBox($MB_ICONINFORMATION, "Cancelled", "The operation was cancelled by the user.") Exit EndIf EndFunc ;==>_CreateTypeData ; ----------------------------------------------- Func _FileOpenDialog() While 1 Local $_sMessage = "Select the required source .wav data..." Local $_ConfirmOpenDialog = MsgBox($MB_YESNO, "Notice!", $_sMessage) ; ------------------------------------------------------ If $_ConfirmOpenDialog = $IDYES Then Local $_sFileOpenDialog = FileOpenDialog($_sMessage, $_sTypeSetName & "\wav", "Wave Data (*.wav;)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT)) If @error Then MsgBox($MB_ICONERROR, "Error", "No wav file(s) selected.") ContinueLoop ; While 1 Endif Local $_WavFiles = StringSplit($_sFileOpenDialog, "|") If $_WavFiles[0] = 1 Then ; if only one file was selected by the user... Local $iPos_LastBackslash = StringInStr($_WavFiles[1], "\", 0, -1) ; -1 starts from the right (+++) ReDim $_WavFiles[3] $_WavFiles[2] = StringMid($_WavFiles[1], $iPos_LastBackslash + 1) ; The file name $_WavFiles[1] = StringLeft($_WavFiles[1], $iPos_LastBackslash - 1) ; The path (without last backslash) $_WavFiles[0] = 2 EndIf Return $_WavFiles Else ; $IDNO MsgBox($MB_ICONINFORMATION, "Cancelled", "The operation was cancelled by the user.") Exit EndIf WEnd EndFunc ;==>_FileOpenDialog ; ----------------------------------------------- Func _FileSelectFolder() While 1 Local $_Message = "Select the Destination folder for the Session .edl file(s)..." Local $_ConfirmFileSelect = MsgBox($MB_YESNO, "Notice!", $_Message) ; ------------------------------------------------------ If $_ConfirmFileSelect = $IDYES Then Local $_DestFolder = FileSelectFolder($_Message, $_sTypeSetName) If @error Then MsgBox($MB_ICONERROR, "Error", "No destination folder selected.") ContinueLoop ; While 1 ; ------------------------------------------------------ ElseIf StringMid($_sTypeSetName, 10, 6) = "Type_1" Then $_MasterEdlFile = "G:\Session_Master\Show\Session_Data\" & $_sMasterType1Edl ; ----------------- ElseIf StringMid($_sTypeSetName, 10, 6) = "Type_2" Then $_MasterEdlFile = "G:\Session_Master\Show\Session_Data\" & $_sMasterType2Edl ; ----------------- ElseIf StringMid($_sTypeSetName, 10, 6) = "Type_3" Then $_MasterEdlFile = "G:\Session_Master\Show\Session_Data\" & $_sMasterType3Edl ; ----------------- ElseIf StringMid($_sTypeSetName, 10, 6) = "Type_4" Then $_MasterEdlFile = "G:\Session_Master\Show\Session_Data\" & $_sMasterType4Edl ; ----------------- Else MsgBox($MB_ICONERROR, "Error", "The " & $_MasterEdlFile & " file was not found.") ContinueLoop ; While 1 EndIf Return $_DestFolder Else ; $IDNO MsgBox($MB_ICONINFORMATION, "Cancelled", "The operation was cancelled by the user.") Exit EndIf WEnd EndFunc ;==>_FileSelectFolder
    1 point
  4. If it's OK to compile your file to x64, I would recommend to do it by including #AutoIt3Wrapper_UseX64=Y at the start of your script. According to my experience, a file compiled to x64 is not flagged by MS Defender.
    1 point
  5. As expected, it is not so long. It will get longer as @MattyD keeps adding functions, but it will be a worthwhile effort. #Region ; #include files in standard AutoIt installation #include <APIErrorsConstants.au3> #include <WinAPIConstants.au3> #include <StructureConstants.au3> #include <AutoItConstants.au3> #EndRegion ; #include files in standard AutoIt installation #Region ; WinRT global variables Global $__g_mIIDs[], $__g_hDLLComBase, $__g_hDLLOle32, $__g_hDLLRoMetaData, $__g_hDLLWinTypes Global Const $sIID_IStorageFileStatics = "{5984C710-DAF2-43C8-8BB4-A4D3EACFD03F}" Global Const $sIID_IAsyncInfo = "{00000036-0000-0000-C000-000000000046}" Global Const $sIID_IAsyncAction = "{5A648006-843A-4DA9-865B-9D26E5DFAD7B}" Global Const $sIID_IMediaSourceStatics = "{F77D6FA4-4652-410E-B1D8-E9A5E245A45C}" Global Const $sIID_IMediaPlayerSource = "{BD4F8897-1423-4C3E-82C5-0FB1AF94F715}" Global Const $sIID_IClosable = "{30D5A829-7FA4-4026-83BB-D75BAE4EA99E}" Global Const $sIID_IMediaPlayer3 = "{EE0660DA-031B-4FEB-BD9B-92E0A0A8D299}" Global $mMediaPlayerState[] $mMediaPlayerState["Closed"] = 0x00000000 $mMediaPlayerState["Opening"] = 0x00000001 $mMediaPlayerState["Buffering"] = 0x00000002 $mMediaPlayerState["Playing"] = 0x00000003 $mMediaPlayerState["Paused"] = 0x00000004 $mMediaPlayerState["Stopped"] = 0x00000005 __WinRT_AddReverseMappings($mMediaPlayerState) Global $mAsyncStatus[] $mAsyncStatus["Canceled"] = 0x00000002 $mAsyncStatus["Completed"] = 0x00000001 $mAsyncStatus["Error"] = 0x00000003 $mAsyncStatus["Started"] = 0x00000000 #EndRegion ; WinRT global variables _WinRT_Startup() Local $pFileFact = _WinRT_GetActivationFactory("Windows.Storage.StorageFile", $sIID_IStorageFileStatics) Local $pAsync = IStorageFileStatics_GetFileFromPathAsync($pFileFact, "C:\Windows\Media\Windows Logon.wav") Local $pFile = _WinRT_WaitForAsync($pAsync, "ptr*") Local $pMediaSrcFact = _WinRT_GetActivationFactory("Windows.Media.Core.MediaSource", $sIID_IMediaSourceStatics) Local $pMediaSrc = IMediaSourceStatics_CreateFromStorageFile($pMediaSrcFact, $pFile) Local $pPlayer = _WinRT_ActivateInstance("Windows.Media.Playback.MediaPlayer") Local $pPlayer_Src = IUnknown_QueryInterface($pPlayer, $sIID_IMediaPlayerSource) IMediaPlayerSource_SetMediaSource($pPlayer_Src, $pMediaSrc) IUnknown_Release($pPlayer_Src) Local $pPlayer_Close = IUnknown_QueryInterface($pPlayer, $sIID_IClosable) Local $pPlayer_3 = IUnknown_QueryInterface($pPlayer, $sIID_IMediaPlayer3) $pPlayer_Session = IMediaPlayer3_GetPlaybackSession($pPlayer_3) IMediaPlayer_Play($pPlayer) Local $iDuration, $sState Do Sleep(10) $sState = _WinRT_GetEnum($mMediaPlayerState, IMediaPlayer_GetCurrentState($pPlayer)) Until $sState = "Playing" $iDuration = IMediaPlayer_GetNaturalDuration($pPlayer) Local $iPos Do $iPos = IMediaPlaybackSession_GetPosition($pPlayer_Session) _DispTime($iPos, $iDuration) Sleep(1000) $sState = _WinRT_GetEnum($mMediaPlayerState, IMediaPlayer_GetCurrentState($pPlayer)) Until $sState = "Paused" IClosable_Close($pPlayer_Close) _WinRT_Shutdown() Func _DispTime($iPos, $iTotal) Local $iTicksPerHour, $iTicksPerMin, $iTicksPerSec Local $iPosHour, $iPosMin, $iPosSec Local $iTotHour, $iTotMin, $iTotSec $iTicksPerSec = 10000000 $iTicksPerMin = 600000000 $iTicksPerHour = 36000000000 $iPosSec = Mod(Round($iPos / $iTicksPerSec), 60) $iPosMin = Mod(Round($iPos / $iTicksPerMin), 60) $iPosHour = Round($iPos / $iTicksPerHour) $iTotSec = Mod(Round($iTotal / $iTicksPerSec), 60) $iTotMin = Mod(Round($iTotal / $iTicksPerMin), 60) $iTotHour = Round($iTotal / $iTicksPerHour) ConsoleWrite(StringFormat("%d:%02d:%02d/%d:%02d:%02d\r\n", $iPosHour, $iPosMin, $iPosSec, $iTotHour, $iTotMin, $iTotSec)) EndFunc #Region ; Functions defined in WinRT.au3 Func _WinRT_WaitForAsync(ByRef $pAsync, $sDataType, $iTimeout = 500) Local $pAsyncInfo = IUnknown_QueryInterface($pAsync, $sIID_IAsyncInfo) If @error Then Return SetError(@error, @extended, -1) Local $hTimer = TimerInit() Local $iStatus, $iError, $vResult = Null Do $iStatus = IAsyncInfo_GetStatus($pAsyncInfo) If TimerDiff($hTimer) > $iTimeout Then ExitLoop Sleep(10) Until $iStatus <> _WinRT_GetEnum($mAsyncStatus, "Started") Switch $iStatus Case _WinRT_GetEnum($mAsyncStatus, "Started") $iStatus = -1 $iError = $WAIT_TIMEOUT Case Else $iError = IAsyncInfo_GetErrorCode($pAsyncInfo) EndSwitch If $iStatus = _WinRT_GetEnum($mAsyncStatus, "Completed") Then IUnknown_QueryInterface($pAsync, $sIID_IAsyncAction) If Not @error Then $vResult = ($iError = $S_OK) Else $vResult = IAsyncOperation_GetResults($pAsync, $sDataType) If @error Then $iError = @error EndIf EndIf _WinRT_DeleteObject($pAsync) Return SetError($iError, $iStatus, $vResult) EndFunc #EndRegion ; Functions defined in WinRT.au3 #Region ; Fuctions defined in WinRTCore.au3 Func _WinRT_ActivateInstance($sClassID) Local $aCall, $hsClassID, $iError $hsClassID = _WinRT_CreateHString($sClassID) If @error Then Return SetError(@error, @extended, Ptr(0)) $aCall = DllCall($__g_hDLLComBase, "long", "RoActivateInstance", "handle", $hsClassID, "ptr*", 0) $iError = @error _WinRT_DeleteHString($hsClassID) If $iError Then Return SetError(__WinRT_GetDllError($iError), 0, Ptr(0)) Return SetError($aCall[0], 0, $aCall[2]) EndFunc ;==>_WinRT_ActivateInstance Func _WinRT_GetActivationFactory($sClassID, $sIID) Local $aCall, $hsClassID, $tIID, $iError $tIID = __WinRT_CreateGUID($sIID) If Not @error Then $hsClassID = _WinRT_CreateHString($sClassID) If @error Then Return SetError(@error, @extended, Ptr(0)) $aCall = DllCall($__g_hDLLComBase, "long", "RoGetActivationFactory", "handle", $hsClassID, "ptr", DllStructGetPtr($tIID), "ptr*", 0) $iError = @error _WinRT_DeleteHString($hsClassID) If $iError Then Return SetError(__WinRT_GetDllError($iError), 0, Ptr(0)) Return SetError($aCall[0], 0, $aCall[3]) EndFunc ;==>_WinRT_GetActivationFactory Func _WinRT_CreateHString($sString) Local $aCall = DllCall($__g_hDLLComBase, "long", "WindowsCreateString", "wstr", $sString, "uint", StringLen($sString), "ptr*", 0) If @error Then Return SetError(__WinRT_GetDllError(), 0, Ptr(0)) Return SetError($aCall[0], 0, $aCall[3]) EndFunc ;==>_WinRT_CreateHString Func _WinRT_DeleteHString(ByRef $hString) Local $aCall = DllCall($__g_hDLLComBase, "long", "WindowsDeleteString", "ptr", $hString) If @error Then Return SetError(__WinRT_GetDllError(), 0, Ptr(0)) $hString = 0 Return SetError($aCall[0], 0, $aCall[0] = 0) EndFunc ;==>_WinRT_DeleteHString Func _WinRT_DeleteObject(ByRef $pObject) Local $iRefCount Do $iRefCount = IUnknown_Release($pObject) If @error Then Return SetError(@error, @extended, False) Until $iRefCount = 0 If Not $iRefCount Then $pObject = Ptr(0) Return ($iRefCount = 0) EndFunc Func _WinRT_GetEnum($mMap, $vKey) If Not IsMap($mMap) Then Return Return $mMap[String($vKey)] EndFunc Func _WinRT_Shutdown() DllClose($__g_hDLLComBase) DllClose($__g_hDLLOle32) DllClose($__g_hDLLRoMetaData) DllClose($__g_hDLLWinTypes) EndFunc ;==>_WinRT_Shutdown Func _WinRT_Startup() $__g_hDLLComBase = DllOpen("Combase.dll") $__g_hDLLOle32 = DllOpen("Ole32.dll") $__g_hDLLRoMetaData = DllOpen("RoMetaData.dll") $__g_hDLLWinTypes = DllOpen("WinTypes.dll") __WinRT_AddReverseMappings($__g_mIIDs) EndFunc ;==>_WinRT_Startup Func __WinRT_AddReverseMappings(ByRef $mMap) If Not IsMap($mMap) Then Return Local $aKeys = MapKeys($mMap), $vKey For $i = 0 To UBound($aKeys) - 1 $vKey = $aKeys[$i] $mMap[String($mMap[$vKey])] = $vKey Next EndFunc ;==>__WinRT_AddReverseMappings Func __WinRT_CreateGUID($sGUID = "{00000000-0000-0000-0000-000000000000}") Local $tGUID = DllStructCreate($tagGUID) Local $aGUID = StringSplit(StringRegExpReplace($sGUID, "[{}]", ""), "-", 2) If UBound($aGUID) <> 5 Then Return SetError($ERROR_INVALID_PARAMETER, 0, False) DllStructSetData($tGUID, 1, Dec($aGUID[0])) DllStructSetData($tGUID, 2, Dec($aGUID[1])) DllStructSetData($tGUID, 3, Dec($aGUID[2])) DllStructSetData($tGUID, 4, Binary("0x" & $aGUID[3] & $aGUID[4])) Return $tGUID EndFunc ;==>__WinRT_CreateGUID Func __WinRT_GetDllError($iError = @error) Switch $iError Case 0 $iError = $ERROR_SUCCESS Case 1 $iError = $ERROR_DLL_INIT_FAILED Case Else $iError = $ERROR_INVALID_PARAMETER EndSwitch Return $iError EndFunc ;==>__WinRT_GetDllError Func __WinRT_GetFuncAddress($pThis, $iIndex) Local Const $PTR_LEN = @AutoItX64 ? 8 : 4 $iIndex -= 1 If IsInt($pThis) Then $pThis = Ptr($pThis) If (Not $pThis) Or (Not IsPtr($pThis)) Then Return SetError($ERROR_INVALID_PARAMETER, 0, Ptr(0)) If ($iIndex < 0) Or (Not IsInt($iIndex)) Then Return SetError($ERROR_INVALID_PARAMETER, 0, Ptr(0)) Local $pVTable = __WinRT_GetPtrAt($pThis) Return __WinRT_GetPtrAt($pVTable + ($iIndex * $PTR_LEN)) EndFunc ;==>__WinRT_GetFuncAddress Func __WinRT_GetProperty_Number($pThis, $iVTableIdx, $sDataType) Local $vFailVal = 0 Switch $sDataType Case "int", "long", "float" $vFailVal = 0 Case "uint", "ulong", "dword" $vFailVal = -1 Case "int64", "double" $vFailVal = Int(0, $NUMBER_64BIT) Case "uint64" $vFailVal = Int(-1, $NUMBER_64BIT) Case "ptr", "handle", "hwnd" $vFailVal = Ptr(0) Case "bool" $vFailVal = Null Case Else Return SetError($ERROR_INVALID_PARAMETER, 0, $vFailVal) EndSwitch Local $pFunc = __WinRT_GetFuncAddress($pThis, $iVTableIdx) If @error Then Return SetError(@error, @extended, $vFailVal) Local $aCall = DllCallAddress("long", $pFunc, "ptr", $pThis, $sDataType & "*", 0) If @error Then Return SetError(__WinRT_GetDllError(), 0, $vFailVal) Return SetError($aCall[0], 0, $aCall[2]) EndFunc ;==>__WinRT_GetProperty_Number Func __WinRT_GetProperty_Ptr($pThis, $iVTableIdx) Local $vFailVal = Ptr(0) Local $pFunc = __WinRT_GetFuncAddress($pThis, $iVTableIdx) If @error Then Return SetError(@error, @extended, $vFailVal) Local $aCall = DllCallAddress("long", $pFunc, "ptr", $pThis, "ptr*", 0) If @error Then Return SetError(__WinRT_GetDllError(), 0, $vFailVal) Return SetError($aCall[0], 0, $aCall[2]) EndFunc ;==>__WinRT_GetProperty_Ptr Func __WinRT_GetPtrAt($pPtr) If (Not $pPtr) Or (Not IsPtr($pPtr)) Then Return SetError($ERROR_INVALID_PARAMETER, 0, Ptr(0)) Local $tPtr = DllStructCreate("ptr", $pPtr) Return DllStructGetData($tPtr, 1) EndFunc ;==>__WinRT_GetPtrAt #EndRegion ; Fuctions defined in WinRTCore.au3 #Region ; Functions defined in IUnknown.au3 Func IUnknown_QueryInterface($pThis, $sIID) Local $vFailVal = Ptr(0) Local $pFunc = __WinRT_GetFuncAddress($pThis, 1) If @error Then Return SetError(@error, @extended, $vFailVal) Local $tIID = __WinRT_CreateGUID($sIID) If @error Then Return SetError(@error, @extended, $vFailVal) Local $aCall = DllCallAddress("long", $pFunc, "ptr", $pThis, "struct*", $tIID, "ptr*", 0) If @error Then Return SetError(__WinRT_GetDllError(), 0, $vFailVal) Return SetError($aCall[0], 0, $aCall[3]) EndFunc ;==>IUnknown_QueryInterface Func IUnknown_Release($pThis) Local $vFailVal = -1 Local $pFunc = __WinRT_GetFuncAddress($pThis, 3) If @error Then Return SetError(@error, @extended, $vFailVal) Local $aCall = DllCallAddress("ulong", $pFunc, "ptr", $pThis) If @error Then Return SetError(__WinRT_GetDllError(), 0, $vFailVal) Return $aCall[0] EndFunc ;==>IUnknown_RemoveRef #EndRegion ; Functions defined in IUnknown.au3 #Region ; Functions defined in Windows.Foundation.IAsyncInfo.au3 Func IAsyncInfo_GetStatus($pThis) Local $vValue = __WinRT_GetProperty_Number($pThis, 8, "ulong") Return SetError(@error, @extended, $vValue) EndFunc Func IAsyncInfo_GetErrorCode($pThis) Local $vValue = __WinRT_GetProperty_Number($pThis, 9, "long") Return SetError(@error, @extended, $vValue) EndFunc #EndRegion ; Functions defined in Windows.Foundation.IAsyncInfo.au3 #Region ; Functions defined in Windows.Foundation.IAsyncOperation.au3 Func IAsyncOperation_GetResults($pThis, $sDataType, $pData = Ptr(0)) Local $vFailVal = Null Local $pFunc = __WinRT_GetFuncAddress($pThis, 9) If @error Then Return SetError(@error, @extended, $vFailVal) If $sDataType = "ptr" And (Not $pData) Then Return SetError($ERROR_INVALID_PARAMETER, 0, $vFailVal) Local $aCall = DllCallAddress("long", $pFunc, "ptr", $pThis, $sDataType, $pData) If @error Then Return SetError(__WinRT_GetDllError(), 0, $vFailVal) Return SetError($aCall[0], 0, $aCall[2]) EndFunc ;==>IAsyncOperation_GetResults #EndRegion ; Functions defined in Windows.Foundation.IAsyncOperation.au3 #Region ; Functions defined in Windows.Foundation.IClosable.au3 Func IClosable_Close($pThis) Local $vFailVal = False Local $pFunc = __WinRT_GetFuncAddress($pThis, 7) If @error Then Return SetError(@error, @extended, $vFailVal) Local $aCall = DllCallAddress("long", $pFunc, "ptr", $pThis) If @error Then Return SetError(__WinRT_GetDllError(), 0, $vFailVal) Return SetError($aCall[0], 0, ($aCall[0] = $S_OK)) EndFunc #EndRegion ; Functions defined in Windows.Foundation.IClosable.au3 #Region ; Functions defined in Windows.Media.Playback.IMediaPlayer.au3 Func IMediaPlayer_Play($pThis) Local $vFailVal = False Local $pFunc = __WinRT_GetFuncAddress($pThis, 46) If @error Then Return SetError(@error, @extended, $vFailVal) Local $aCall = DllCallAddress("long", $pFunc, "ptr", $pThis) If @error Then Return SetError(__WinRT_GetDllError(), 0, $vFailVal) Return SetError($aCall[0], 0, ($aCall[0] = $S_OK)) EndFunc Func IMediaPlayer_Pause($pThis) Local $vFailVal = False Local $pFunc = __WinRT_GetFuncAddress($pThis, 47) If @error Then Return SetError(@error, @extended, $vFailVal) Local $aCall = DllCallAddress("long", $pFunc, "ptr", $pThis) If @error Then Return SetError(__WinRT_GetDllError(), 0, $vFailVal) Return SetError($aCall[0], 0, ($aCall[0] = $S_OK)) EndFunc Func IMediaPlayer_GetCurrentState($pThis) Local $vValue = __WinRT_GetProperty_Number($pThis, 13, "ulong") Return SetError(@error, @extended, $vValue) EndFunc Func IMediaPlayer_GetNaturalDuration($pThis) Local $vValue = __WinRT_GetProperty_Number($pThis, 9, "int64") Return SetError(@error, @extended, $vValue) EndFunc #EndRegion ; Functions defined in Windows.Media.Playback.IMediaPlayer.au3 #Region ; Functions defined in Windows.Media.Playback.IMediaPlayer3.au3 Func IMediaPlayer3_GetPlaybackSession($pThis) Local $vValue = __WinRT_GetProperty_Ptr($pThis, 25) Return SetError(@error, @extended, $vValue) EndFunc #EndRegion ; Functions defined in Windows.Media.Playback.IMediaPlayer3.au3 #Region ; Functions defined in Windows.Media.Playback.IMediaPlaybackSession.au3 Func IMediaPlaybackSession_GetPosition($pThis) Local $vValue = __WinRT_GetProperty_Number($pThis, 29, "int64") Return SetError(@error, @extended, $vValue) EndFunc #EndRegion ; Functions defined in Windows.Media.Playback.IMediaPlaybackSession.au3 #Region ; Functions defined in Windows.Media.Playback.IMediaPlayerSource.au3 Func IMediaPlayerSource_SetMediaSource($pThis, $pSource) Local $vFailVal = False Local $pFunc = __WinRT_GetFuncAddress($pThis, 11) If @error Then Return SetError(@error, @extended, $vFailVal) If $pSource And IsInt($pSource) Then $pSource = Ptr($pSource) If $pSource And (Not IsPtr($pSource)) Then Return SetError($ERROR_INVALID_PARAMETER, 0, $vFailVal) Local $aCall = DllCallAddress("long", $pFunc, "ptr", $pThis, "ptr", $pSource) If @error Then Return SetError(__WinRT_GetDllError(), 0, $vFailVal) Return SetError($aCall[0], 0, ($aCall[0] = $S_OK)) EndFunc #EndRegion ; Functions defined in Windows.Media.Playback.IMediaPlayerSource.au3 #Region ; Functions defined in Windows.Media.Core.IMediaSourceStatics.au3 Func IMediaSourceStatics_CreateFromStorageFile($pThis, $pFile) Local $vFailVal = Ptr(0) Local $pFunc = __WinRT_GetFuncAddress($pThis, 11) If @error Then Return SetError(@error, @extended, $vFailVal) If $pFile And IsInt($pFile) Then $pFile = Ptr($pFile) If $pFile And (Not IsPtr($pFile)) Then Return SetError($ERROR_INVALID_PARAMETER, 0, $vFailVal) Local $aCall = DllCallAddress("long", $pFunc, "ptr", $pThis, "ptr", $pFile, "ptr*", 0) If @error Then Return SetError(__WinRT_GetDllError(), 0, $vFailVal) Return SetError($aCall[0], 0, $aCall[3]) EndFunc #EndRegion ; Functions defined in Windows.Media.Core.IMediaSourceStatics.au3 #Region ; Functions defined in Windows.Storage.IStorageFileStatics.au3 Func IStorageFileStatics_GetFileFromPathAsync($pThis, $sPath) Local $vFailVal = Ptr(0) Local $pFunc = __WinRT_GetFuncAddress($pThis, 7) If @error Then Return SetError(@error, @extended, $vFailVal) If ($sPath) And (Not IsString($sPath)) Then Return SetError($ERROR_INVALID_PARAMETER, 0, $vFailVal) Local $hPath = _WinRT_CreateHString($sPath) Local $aCall = DllCallAddress("long", $pFunc, "ptr", $pThis, "handle", $hPath, "ptr*", 0) Local $iError = @error _WinRT_DeleteHString($hPath) If $iError Then Return SetError(__WinRT_GetDllError($iError), 0, $vFailVal) Return SetError($aCall[0], 0, $aCall[3]) EndFunc #EndRegion ; Functions defined in Windows.Storage.IStorageFileStatics.au3
    1 point
×
×
  • Create New...