Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/16/2012 in all areas

  1. wolf9228

    DirectShow

    Video Files (avi|qt|mov|mpg|mpeg|m1v|wmv) Audio Files (wav|mpa|mp2|mp3|au|aif|aiff|snd) MIDI Files (mid|midi|rmi) Image Files (jpg|bmp|gif) And Other http://msdn.microsoft.com/en-us/library/windows/desktop/dd375454%28v=vs.85%29.aspx The Microsoft DirectShow application programming interface (API) is a media-streaming architecture for Microsoft Windows. Using DirectShow, your applications can perform high-quality video and audio playback or capture. The DirectShow headers, libraries, SDK tools, and samples are available in the Windows SDK. Note Previous versions of the DirectShow SDK were included in the DirectX SDK. The last version of the DirectX SDK to include DirectShow was DirectX 9.0 SDK Update - (February 2005) Extras. After this version, DirectShow was moved to the Windows SDK. To get the latest version of the DirectShow headers, libraries, and samples, download the Windows SDK. http://msdn.microsoft.com/en-us/library/windows/desktop/dd390085%28v=vs.85%29.aspx IGraphBuilder interface This interface provides methods that enable an application to build a filter graph. The Filter Graph Manager implements this interface. The IGraphBuilder interface inherits from the IFilterGraph interface. IFilterGraph provides basic operations, such as adding a filter to the graph or connecting two pins. IGraphBuilder adds further methods that construct graphs from partial information. For example, the IGraphBuilder::RenderFile method builds a graph for file playback, given the name of the file. The IGraphBuilder::Render method renders data from an output pin by connecting new filters to the pin. Using these methods, an application does not need to specify every filter and pin connection in the graph. Instead, the Filter Graph Manager selects filters that are registered on the user's system, adds them to the graph, and connects them. For more information, see Intelligent Con script Files New script Files Have been some additions and amendments to the new version of the Autoit language Of these additives function call CoInitialize in reference Of Autoit language So the project Of this topic does not work on the new version of Autoit language Error in the construction Of CoInitialize function in this project . The project has been edited and repaired New script Files New New_DirectShow(1).zip New Image Files New http://www.2shared.com/file/SqJ-kp6X/New_DirectShow_1_.html DirectShow.au3 New #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "InterfaceCall.au3" Global $CoInitialize = False , $Ole32 = DllOpen("Ole32.dll"),$MsgGraphArray = 0,$StartGraph = 0 Const $WM_GRAPHNOTIFY = $WM_APP + 1 ;Video Files (avi|qt|mov|mpg|mpeg|m1v|wmv) ;Audio files (wav|mpa|mp2|mp3|au|aif|aiff|snd) ;MIDI Files (mid|midi|rmi) ;Image Files (jpg|bmp|gif) ;And Other Func GUICtrlCreateGraph($Gui,$FileName,$L,$T,$W,$H,$Style = -1,$ExStyle = -1,$Run = True) ;$FileName the name of a media file if $Style = -1 Then $Style = BitOR($WS_CHILD,$WS_CLIPCHILDREN,$WS_CLIPSIBLINGS) if $ExStyle = -1 Then $ExStyle = 0 $StrIID_IGraphBuilder = "{56a868a9-0ad4-11ce-b03a-0020af0ba770}" $StrCLSID_FilterGraph = "{e436ebb3-524f-11ce-9f53-0020af0ba770}" $NewIGraphBuilder = GetObjFromGuid($StrIID_IGraphBuilder,$StrCLSID_FilterGraph) if @error Then Return SetError(1,0,0) if $StartGraph = 0 Then GUIRegisterMsg($WM_GRAPHNOTIFY,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_ERASEBKGND,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_ACTIVATEAPP,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_DEVMODECHANGE,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_DISPLAYCHANGE,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_PALETTECHANGED,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_PALETTEISCHANGING,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_QUERYNEWPALETTE,"CREATEGRAPH_WM_MSG") $StartGraph = 1 ElseIf $StartGraph = 2 Then GUIRegisterMsg($WM_ERASEBKGND,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_ACTIVATEAPP,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_DEVMODECHANGE,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_DISPLAYCHANGE,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_PALETTECHANGED,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_PALETTEISCHANGING,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_QUERYNEWPALETTE,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_SYSCOLORCHANGE,"CREATEGRAPH_WM_MSG") EndIf Add_Remove_MsgGraphArray($NewIGraphBuilder) ; Add ;-------IGraphBuilder RenderFile Virtual Method Number Is 14;---------------- $Rt = InterfaceCall($NewIGraphBuilder,"long",14,"wstr",$FileName,"ptr",0) if @error Or $Rt[0] <> 0 Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove CtrlGraphRelease($NewIGraphBuilder) Return SetError(2,0,0) EndIf ;-------IGraphBuilder RenderFile Virtual Method Number Is 14;---------------- $IVideoWindow = GetIVideoWindow($NewIGraphBuilder) if @error Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove CtrlGraphRelease($NewIGraphBuilder) Return SetError(3,0,0) EndIf $IMediaEventEx = GetIMediaEventEx($NewIGraphBuilder) if @error Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove CtrlGraphRelease($NewIGraphBuilder,$IVideoWindow) Return SetError(4,0,0) EndIf ;-------IMediaEventEx SetNotifyWindow Virtual Method Number Is 14;---------------- $Rt = InterfaceCall($IMediaEventEx,"long",14,"ptr",$Gui,"long",$WM_GRAPHNOTIFY,"ptr",0) if @error Or $Rt[0] <> 0 Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove CtrlGraphRelease($NewIGraphBuilder,$IVideoWindow,$IMediaEventEx) Return SetError(5,0,0) EndIf ;-------IMediaEventEx SetNotifyWindow Virtual Method Number Is 14;---------------- ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- $Rt = InterfaceCall($IVideoWindow,"long",30,"ptr",$Gui) if @error Or $Rt[0] <> 0 Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove CtrlGraphRelease($NewIGraphBuilder,$IVideoWindow,$IMediaEventEx) Return SetError(6,0,0) EndIf ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- ;-------IVideoWindow put_MessageDrain Virtual Method Number Is 32;---------------- $Rt = InterfaceCall($IVideoWindow,"long",32,"ptr",$Gui) if @error Or $Rt[0] <> 0 Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove CtrlGraphRelease($NewIGraphBuilder,$IVideoWindow,$IMediaEventEx) Return SetError(7,0,0) EndIf ;-------IVideoWindow put_MessageDrain Virtual Method Number Is 32;---------------- ;-------IVideoWindow SetWindowPosition Virtual Method Number Is 40;---------------- $Rt = InterfaceCall($IVideoWindow,"long",40,"long",$L,"long",$T,"long",$W,"long",$H) if @error Or $Rt[0] <> 0 Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- $Rt = InterfaceCall($IVideoWindow,"long",30,"ptr",0) ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- CtrlGraphRelease($NewIGraphBuilder,$IVideoWindow,$IMediaEventEx) Return SetError(8,0,0) EndIf ;-------IVideoWindow SetWindowPosition Virtual Method Number Is 40;---------------- ;-------IVideoWindow put_WindowStyle Virtual Method Number Is 10;---------------- $Rt = InterfaceCall($IVideoWindow,"long",10,"long",$Style) if @error Or $Rt[0] <> 0 Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- $Rt = InterfaceCall($IVideoWindow,"long",30,"ptr",0) ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- CtrlGraphRelease($NewIGraphBuilder,$IVideoWindow,$IMediaEventEx) Return SetError(9,0,0) EndIf ;-------IVideoWindow put_WindowStyle Virtual Method Number Is 10;---------------- ;-------IVideoWindow put_WindowStyleEx Virtual Method Number Is 12;---------------- $Rt = InterfaceCall($IVideoWindow,"long",12,"long",$ExStyle) if @error Or $Rt[0] <> 0 Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- $Rt = InterfaceCall($IVideoWindow,"long",30,"ptr",0) ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- CtrlGraphRelease($NewIGraphBuilder,$IVideoWindow,$IMediaEventEx) Return SetError(10,0,0) EndIf ;-------IVideoWindow put_WindowStyleEx Virtual Method Number Is 12;---------------- ;-------IVideoWindow put_AutoShow Virtual Method Number Is 14;---------------- $Rt = InterfaceCall($IVideoWindow,"long",14,"long",-1) if @error Or $Rt[0] <> 0 Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- $Rt = InterfaceCall($IVideoWindow,"long",30,"ptr",0) ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- CtrlGraphRelease($NewIGraphBuilder,$IVideoWindow,$IMediaEventEx) Return SetError(11,0,0) EndIf ;-------IVideoWindow put_AutoShow Virtual Method Number Is 14;---------------- if ($Run) Then IMediaControl_Run($NewIGraphBuilder) EndIf CtrlGraphRelease($IVideoWindow,$IMediaEventEx) Return SetError(0,0,$NewIGraphBuilder) EndFunc Func Re_GUICtrlCreateGraph(ByRef $OutIGraphBuilder,$FileName,$Run = True) $IVideoWindow = GetIVideoWindow($OutIGraphBuilder) if @error Then Return SetError(1,0,False) $IMediaEventEx = GetIMediaEventEx($OutIGraphBuilder) if @error Then Return SetError(2,0,False) ;-------IVideoWindow get_WindowStyle Virtual Method Number Is 11;---------------- $Rt = InterfaceCall($IVideoWindow,"long",11,"long*",0) if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow,$IMediaEventEx) Return SetError(3,0,False) EndIf $Style = $Rt[1] ;-------IVideoWindow get_WindowStyle Virtual Method Number Is 11;---------------- ;-------IVideoWindow get_WindowStyleEx Virtual Method Number Is 13;---------------- $Rt = InterfaceCall($IVideoWindow,"long",13,"long*",0) if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow,$IMediaEventEx) Return SetError(4,0,False) EndIf $ExStyle = $Rt[1] ;-------IVideoWindow get_WindowStyleEx Virtual Method Number Is 13;---------------- ;-------IVideoWindow get_Owner Virtual Method Number Is 31;---------------- $Rt = InterfaceCall($IVideoWindow,"long",31,"ptr*",0) if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow,$IMediaEventEx) Return SetError(5,0,False) EndIf $Gui = $Rt[1] ;-------IVideoWindow get_Owner Virtual Method Number Is 31;---------------- ;-------IVideoWindow GetRestorePosition Virtual Method Number Is 44;---------------- $Rt = InterfaceCall($IVideoWindow,"long",44,"long*",0,"long*",0,"long*",0,"long*",0) if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow,$IMediaEventEx) Return SetError(6,0,False) EndIf $L = $Rt[1] $T = $Rt[2] $W = $Rt[3] $H = $Rt[4] ;-------IVideoWindow GetRestorePosition Virtual Method Number Is 44;------------ $RtIGraphBuilder = GUICtrlCreateGraph($Gui,$FileName,$L,$T,$W,$H,$Style,$ExStyle,$Run) if @error Then CtrlGraphRelease($IVideoWindow,$IMediaEventEx) Return SetError(7,0,False) Else IMediaControl_Stop($OutIGraphBuilder) Add_Remove_MsgGraphArray($OutIGraphBuilder,2) ; Remove ;-------IMediaEventEx SetNotifyWindow Virtual Method Number Is 14;---------------- $Rt = InterfaceCall($IMediaEventEx,"long",14,"ptr",0,"long",0,"ptr",0) ;-------IMediaEventEx SetNotifyWindow Virtual Method Number Is 14;---------------- ;-------IVideoWindow put_Visible Virtual Method Number Is 20;---------------- $Rt = InterfaceCall($IVideoWindow,"long",20,"long",0) ;-------IVideoWindow put_Visible Virtual Method Number Is 20;---------------- ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- $Rt = InterfaceCall($IVideoWindow,"long",30,"ptr",0) ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- CtrlGraphRelease($OutIGraphBuilder,$IVideoWindow,$IMediaEventEx) $OutIGraphBuilder = $RtIGraphBuilder EndIf Return SetError(0,0,True) EndFunc Func GUICtrlDeleteGraph(ByRef $OutIGraphBuilder) $IVideoWindow = GetIVideoWindow($OutIGraphBuilder) if @error Then Return SetError(1,0,False) $IMediaEventEx = GetIMediaEventEx($OutIGraphBuilder) if @error Then Return SetError(2,0,False) IMediaControl_Stop($OutIGraphBuilder) Add_Remove_MsgGraphArray($OutIGraphBuilder,2) ; Remove ;-------IMediaEventEx SetNotifyWindow Virtual Method Number Is 14;---------------- $Rt = InterfaceCall($IMediaEventEx,"long",14,"ptr",0,"long",0,"ptr",0) ;-------IMediaEventEx SetNotifyWindow Virtual Method Number Is 14;---------------- ;-------IVideoWindow put_Visible Virtual Method Number Is 20;---------------- $Rt = InterfaceCall($IVideoWindow,"long",20,"long",0) ;-------IVideoWindow put_Visible Virtual Method Number Is 20;---------------- ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- $Rt = InterfaceCall($IVideoWindow,"long",30,"ptr",0) ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- CtrlGraphRelease($IVideoWindow,$OutIGraphBuilder,$IMediaEventEx) $OutIGraphBuilder = 0 Return SetError(0,0,True) EndFunc Func CtrlCreateAudio($Gui,$FileName,$Run = True) ;$FileName the name of a media file $StrIID_IGraphBuilder = "{56a868a9-0ad4-11ce-b03a-0020af0ba770}" $StrCLSID_FilterGraph = "{e436ebb3-524f-11ce-9f53-0020af0ba770}" $NewIGraphBuilder = GetObjFromGuid($StrIID_IGraphBuilder,$StrCLSID_FilterGraph) if @error Then Return SetError(1,0,0) if $StartGraph = 0 Then GUIRegisterMsg($WM_GRAPHNOTIFY,"CREATEGRAPH_WM_MSG") $StartGraph = 2 EndIf Add_Remove_MsgGraphArray($NewIGraphBuilder) ; Add ;-------IGraphBuilder RenderFile Virtual Method Number Is 14;---------------- $Rt = InterfaceCall($NewIGraphBuilder,"long",14,"wstr",$FileName,"ptr",0) if @error Or $Rt[0] <> 0 Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove CtrlGraphRelease($NewIGraphBuilder) Return SetError(2,0,0) EndIf ;-------IGraphBuilder RenderFile Virtual Method Number Is 14;---------------- $IMediaEventEx = GetIMediaEventEx($NewIGraphBuilder) if @error Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove CtrlGraphRelease($NewIGraphBuilder) Return SetError(3,0,0) EndIf ;-------IMediaEventEx SetNotifyWindow Virtual Method Number Is 14;---------------- $Rt = InterfaceCall($IMediaEventEx,"long",14,"ptr",$Gui,"long",$WM_GRAPHNOTIFY,"ptr",0) if @error Or $Rt[0] <> 0 Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove CtrlGraphRelease($NewIGraphBuilder,$IMediaEventEx) Return SetError(4,0,0) EndIf ;-------IMediaEventEx SetNotifyWindow Virtual Method Number Is 14;---------------- if ($Run) Then IMediaControl_Run($NewIGraphBuilder) EndIf CtrlGraphRelease($IMediaEventEx) Return SetError(0,0,$NewIGraphBuilder) EndFunc Func CtrlDeleteAudio(ByRef $OutIGraphBuilder) $IMediaEventEx = GetIMediaEventEx($OutIGraphBuilder) if @error Then Return SetError(1,0,False) $State = IMediaControl_GetState($OutIGraphBuilder) if @error Then Return SetError(2,0,False) if $State = 2 Or $State = 1 Then IMediaControl_Stop($OutIGraphBuilder) EndIf ;-------IMediaEventEx SetNotifyWindow Virtual Method Number Is 14;---------------- $Rt = InterfaceCall($IMediaEventEx,"long",14,"ptr",0,"long",0,"ptr",0) ;-------IMediaEventEx SetNotifyWindow Virtual Method Number Is 14;---------------- Add_Remove_MsgGraphArray($OutIGraphBuilder,2) ; Remove CtrlGraphRelease($OutIGraphBuilder,$IMediaEventEx) $OutIGraphBuilder = 0 Return SetError(0,0,True) EndFunc Func GetIVideoWindow($IGraphBuilder) $IID_IVideoWindow = IIDFromString("{56a868b4-0ad4-11ce-b03a-0020af0ba770}") if @error Then Return SetError(1,0,0) ;---------IUnknown QueryInterface Virtual Method Number Is 1;------------------- $Rt = InterfaceCall($IGraphBuilder,"long",1,"struct*",$IID_IVideoWindow,"ptr*",0) ;---------IUnknown QueryInterface Virtual Method Number Is 1;------------------- if @error Or $Rt[0] <> 0 Then Return SetError(2,0,0) Return SetError(0,0,$Rt[2]) EndFunc Func GetIMediaControl($IGraphBuilder) $IID_IMediaControl = IIDFromString("{56a868b1-0ad4-11ce-b03a-0020af0ba770}") if @error Then Return SetError(1,0,0) ;---------IUnknown QueryInterface Virtual Method Number Is 1;------------------- $Rt = InterfaceCall($IGraphBuilder,"long",1,"struct*",$IID_IMediaControl,"ptr*",0) ;---------IUnknown QueryInterface Virtual Method Number Is 1;------------------- if @error Or $Rt[0] <> 0 Then Return SetError(2,0,0) Return SetError(0,0,$Rt[2]) EndFunc Func GetIMediaSeeking($IGraphBuilder) $IID_IMediaSeeking = IIDFromString("{36b73880-c2c8-11cf-8b46-00805f6cef60}") if @error Then Return SetError(1,0,0) ;---------IUnknown QueryInterface Virtual Method Number Is 1;------------------- $Rt = InterfaceCall($IGraphBuilder,"long",1,"struct*",$IID_IMediaSeeking,"ptr*",0) ;---------IUnknown QueryInterface Virtual Method Number Is 1;------------------- if @error Or $Rt[0] <> 0 Then Return SetError(2,0,0) Return SetError(0,0,$Rt[2]) EndFunc Func GetIMediaEventEx($IGraphBuilder) $IID_IMediaEventEx = IIDFromString("{56a868c0-0ad4-11ce-b03a-0020af0ba770}") if @error Then Return SetError(1,0,0) ;---------IUnknown QueryInterface Virtual Method Number Is 1;------------------- $Rt = InterfaceCall($IGraphBuilder,"long",1,"struct*",$IID_IMediaEventEx,"ptr*",0) ;---------IUnknown QueryInterface Virtual Method Number Is 1;------------------- if @error Or $Rt[0] <> 0 Then Return SetError(2,0,0) Return SetError(0,0,$Rt[2]) EndFunc Func CREATEGRAPH_WM_MSG($hWnd,$Msg,$wParam,$lParam) if IsArray($MsgGraphArray) Then For $i = 0 To UBound($MsgGraphArray) - 1 Switch $Msg Case $WM_GRAPHNOTIFY Local $EC_COMPLETE = 0x01 $IMediaEventEx = GetIMediaEventEx($MsgGraphArray[$i]) if Not @error Then ;-------IMediaEventEx GetEvent Virtual Method Number Is 9;---------------- $Rt = InterfaceCall($IMediaEventEx,"long",9,"Long*",0,"LONG_PTR*",0,"LONG_PTR*",0,"long",100) ;-------IMediaEventEx GetEvent Virtual Method Number Is 9;---------------- if Not @error And $Rt[0] = 0 Then $lEventCode = $Rt[1] $lParam1 = $Rt[2] $lParam2 = $Rt[3] if $lEventCode = $EC_COMPLETE Then IMediaControl_StopWhenReady($MsgGraphArray[$i]) EndIf ;-------IMediaEventEx FreeEventParams Virtual Method Number Is 13;---------------- InterfaceCall($IMediaEventEx,"long",13,"Long",$lEventCode,"LONG_PTR",$lParam1,"LONG_PTR",$lParam2) ;-------IMediaEventEx FreeEventParams Virtual Method Number Is 13;---------------- EndIf EndIf Case $WM_ERASEBKGND $IVideoWindow = GetIVideoWindow($MsgGraphArray[$i]) if Not @error Then ;-------IVideoWindow put_BackgroundPalette Virtual Method Number Is 18;---------------- ;The put_BackgroundPalette method specifies whether the video window realizes its palette ;in the background. ;BackgroundPalette [in] ;Specifies whether the video renderer realizes it palette in the background. Must be one of ;the following values: ;Value Description ;OATRUE = -1 The video renderer realizes the palette in the background. ;OAFALSE = 0 The video renderer does not realize the palette in the background. (Default.) Local $BackgroundPalette = -1 $Rt = InterfaceCall($IVideoWindow,"long",18,"long",$BackgroundPalette) ;-------IVideoWindow put_BackgroundPalette Virtual Method Number Is 18;---------------- CtrlGraphRelease($IVideoWindow) ; No Return EndIf Case Else $IVideoWindow = GetIVideoWindow($MsgGraphArray[$i]) if Not @error Then ;-------IVideoWindow NotifyOwnerMessage Virtual Method Number Is 39;---------------- InterfaceCall($IVideoWindow,"long",39,"ptr",$hWnd,"long",$Msg,"long",$wParam,"long",$lParam) ;-------IVideoWindow NotifyOwnerMessage Virtual Method Number Is 39;---------------- CtrlGraphRelease($IVideoWindow) Return $GUI_RUNDEFMSG EndIf EndSwitch Next EndIf EndFunc Func CREATEGRAPH_ON_EXIT() DllCall($Ole32,"long","CoUninitialize") DllClose($Ole32) EndFunc Func IMediaSeeking_SeekToCurrent($IGraphBuilder) ;-------IMediaSeeking SetPositions Virtual Method Number Is 15;---------------- $IMediaSeeking = GetIMediaSeeking($IGraphBuilder) if @error Then Return SetError(1,0,False) $Rt = InterfaceCall($IMediaSeeking,"long",15,"INT64*",0,"DWORD",0x1,"INT64*",0,"DWORD",0) ;-------IMediaSeeking SetPositions Virtual Method Number Is 15;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IMediaSeeking) Return SetError(2,0,False) EndIf IMediaControl_Stop($IGraphBuilder) CtrlGraphRelease($IMediaSeeking) Return SetError(0,0,True) EndFunc Func IMediaControl_Run($IGraphBuilder) $IMediaControl = GetIMediaControl($IGraphBuilder) if @error Then Return SetError(1,0,False) $State = IMediaControl_GetState($IGraphBuilder) if @error Then Return SetError(2,0,False) if $State = 2 Then IMediaControl_Stop($IGraphBuilder) if @error Then Return SetError(3,0,False) EndIf if $State = 2 Or $State = 0 Then IMediaSeeking_SeekToCurrent($IGraphBuilder) if @error Then Return SetError(4,0,False) EndIf ;-------IMediaControl Run Virtual Method Number Is 8;---------------- $Rt = InterfaceCall($IMediaControl,"long",8) ;-------IMediaControl Run Virtual Method Number Is 8;---------------- if @error Or $Rt[0] <> 1 Then CtrlGraphRelease($IMediaControl) Return SetError(5,0,False) EndIf CtrlGraphRelease($IMediaControl) Return SetError(0,0,True) EndFunc Func IMediaControl_Pause($IGraphBuilder) $IMediaControl = GetIMediaControl($IGraphBuilder) if @error Then Return SetError(1,0,False) ;-------IMediaControl Pause Virtual Method Number Is 9;---------------- $Rt = InterfaceCall($IMediaControl,"long",9) ;-------IMediaControl Pause Virtual Method Number Is 9;---------------- if @error Or $Rt[0] <> 1 Then CtrlGraphRelease($IMediaControl) Return SetError(2,0,False) EndIf Return SetError(0,0,True) EndFunc Func IMediaControl_Stop($IGraphBuilder) $IMediaControl = GetIMediaControl($IGraphBuilder) if @error Then Return SetError(1,0,False) ;-------IMediaControl Stop Virtual Method Number Is 10;---------------- $Rt = InterfaceCall($IMediaControl,"long",10) ;-------IMediaControl Stop Virtual Method Number Is 10;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IMediaControl) Return SetError(2,0,False) EndIf CtrlGraphRelease($IMediaControl) Return SetError(0,0,True) EndFunc Func IMediaControl_StopWhenReady($IGraphBuilder) $IMediaControl = GetIMediaControl($IGraphBuilder) if @error Then Return SetError(1,0,False) ;-------IMediaControl StopWhenReady Virtual Method Number Is 16;---------------- $Rt = InterfaceCall($IMediaControl,"long",16) ;-------IMediaControl StopWhenReady Virtual Method Number Is 16;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IMediaControl) Return SetError(2,0,False) EndIf CtrlGraphRelease($IMediaControl) Return SetError(0,0,True) EndFunc Func IMediaControl_GetState($IGraphBuilder) ;enum _FilterState ;{ State_Stopped = 0, ;State_Paused = State_Stopped + 1, ;State_Running = State_Paused + 1 ;} FILTER_STATE; $IMediaControl = GetIMediaControl($IGraphBuilder) if @error Then Return SetError(1,0,-1) ;-------IMediaControl GetState Virtual Method Number Is 11;---------------- $Rt = InterfaceCall($IMediaControl,"long",11,"long",1000,"long*",0) ;-------IMediaControl GetState Virtual Method Number Is 11;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IMediaControl) Return SetError(2,0,-1) EndIf CtrlGraphRelease($IMediaControl) Return SetError(0,0,$Rt[2]) EndFunc Func IVideoWindow_put_Owner($IGraphBuilder,$Gui) $IVideoWindow = GetIVideoWindow($IGraphBuilder) if @error Then Return SetError(1,0,False) ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- $Rt = InterfaceCall($IVideoWindow,"long",30,"ptr",$Gui) ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow) Return SetError(2,0,False) EndIf CtrlGraphRelease($IVideoWindow) Return SetError(0,0,True) EndFunc Func IVideoWindow_SetWindowPosition($IGraphBuilder,$L,$T,$W,$H) $IVideoWindow = GetIVideoWindow($IGraphBuilder) if @error Then Return SetError(1,0,False) ;-------IVideoWindow SetWindowPosition Virtual Method Number Is 40;---------------- $Rt = InterfaceCall($IVideoWindow,"long",40,"long",$L,"long",$T,"long",$W,"long",$H) ;-------IVideoWindow SetWindowPosition Virtual Method Number Is 40;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow) Return SetError(2,0,False) EndIf CtrlGraphRelease($IVideoWindow) Return SetError(0,0,True) EndFunc Func IVideoWindow_put_WindowState($IGraphBuilder,$WindowState) $IVideoWindow = GetIVideoWindow($IGraphBuilder) if @error Then Return SetError(1,0,False) ;The put_WindowState method shows, hides, minimizes, or maximizes the video window. ;WindowState ;Flag that specifies how the window is to be shown. The value can be any ;constant defined for the nCmdShow parameter of the ShowWindow function. ;-------IVideoWindow put_WindowState Virtual Method Number Is 16;---------------- $Rt = InterfaceCall($IVideoWindow,"long",16,"long",$WindowState) ;-------IVideoWindow Sput_WindowState Virtual Method Number Is 16;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow) Return SetError(2,0,False) EndIf CtrlGraphRelease($IVideoWindow) Return SetError(0,0,True) EndFunc Func IVideoWindow_put_FullScreenMode($IGraphBuilder,$FullScreenMode) $IVideoWindow = GetIVideoWindow($IGraphBuilder) if @error Then Return SetError(1,0,False) ;Sets a hotkey that calls a user function. ;HotKeySet("{ESC}", "HotKeyFullScreenMode") ;Func HotKeyFullScreenMode() ;IVideoWindow_put_FullScreenMode($IGraphBuilder,$FullScreenMode) ;EndFunc ;The put_FullScreenMode method enables or disables full-screen video rendering. ;FullScreenMode [in] ;Boolean value that specifies whether to enable or disable full-screen mode. Must be one ;of the following values: ;Value Description ;OATRUE = -1 Switch to full-screen mode. ;OAFALSE = 0 Disable full-screen mode. (Default.) ;-------IVideoWindow put_FullScreenMode Virtual Method Number Is 37;---------------- $Rt = InterfaceCall($IVideoWindow,"long",37,"long",$FullScreenMode) ;-------IVideoWindow put_FullScreenMode Virtual Method Number Is 37;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow) Return SetError(2,0,False) EndIf CtrlGraphRelease($IVideoWindow) Return SetError(0,0,True) EndFunc Func IVideoWindow_HideCursor($IGraphBuilder,$HideCursor) $IVideoWindow = GetIVideoWindow($IGraphBuilder) if @error Then Return SetError(1,0,False) ;The SetWindowForeground method places the video window at the top of the Z order. ;HideCursor [in] ;Specifies whether to show or hide the cursor. Must be one of the following values: ;Value Meaning ;OATRUE = -1 Hide the cursor. ;OAFALSE = 0 Show the cursor. ;-------IVideoWindow HideCursor Virtual Method Number Is 45;---------------- $Rt = InterfaceCall($IVideoWindow,"long",45,"long",$HideCursor) ;-------IVideoWindow HideCursor Virtual Method Number Is 45;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow) Return SetError(2,0,False) EndIf CtrlGraphRelease($IVideoWindow) Return SetError(0,0,True) EndFunc Func IVideoWindow_SetWindowForeground($IGraphBuilder,$Focus) $IVideoWindow = GetIVideoWindow($IGraphBuilder) if @error Then Return SetError(1,0,False) ;The SetWindowForeground method places the video window at the top of the Z order. ;Focus ;Specifies whether to give the window focus. Must be one of the following values: ;Value Description ;OATRUE = -1 Give the window focus. ;OAFALSE = 0 Do not give the window focus. ;-------IVideoWindow SetWindowForeground Virtual Method Number Is 38;---------------- $Rt = InterfaceCall($IVideoWindow,"long",38,"long",$Focus) ;-------IVideoWindow SetWindowForeground Virtual Method Number Is 38;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow) Return SetError(2,0,False) EndIf CtrlGraphRelease($IVideoWindow) Return SetError(0,0,True) EndFunc Func IVideoWindow_put_BorderColor($IGraphBuilder,$Color) $IVideoWindow = GetIVideoWindow($IGraphBuilder) if @error Then Return SetError(1,0,False) ;-------IVideoWindow put_BorderColor Virtual Method Number Is 35;---------------- $Rt = InterfaceCall($IVideoWindow,"long",35,"long",$Color) ;-------IVideoWindow put_BorderColor Virtual Method Number Is 35;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow) Return SetError(2,0,False) EndIf CtrlGraphRelease($IVideoWindow) Return SetError(0,0,True) EndFunc Func CtrlGraphRelease($IUnknown1 = 0,$IUnknown2 = 0,$IUnknown3 = 0) if ($IUnknown1) Then IUnknownRelease($IUnknown1) if ($IUnknown2) Then IUnknownRelease($IUnknown2) if ($IUnknown3) Then IUnknownRelease($IUnknown3) EndFunc Func Add_Remove_MsgGraphArray($IGraphBuilderObj,$Flag = 1) ;$Flag = 1 Add ;$Flag = 2 Remove Switch $Flag Case 1 if Not IsArray($MsgGraphArray) Then Local $TempMsgGraphArray[1] $TempMsgGraphArray[0] = $IGraphBuilderObj $MsgGraphArray = $TempMsgGraphArray Return SetError(0,0,True) Else For $i = 0 To UBound($MsgGraphArray) - 1 if $IGraphBuilderObj = $MsgGraphArray[$i] Then Return SetError(1,0,False) Next ReDim $MsgGraphArray[UBound($MsgGraphArray) + 1] $MsgGraphArray[UBound($MsgGraphArray) - 1] = $IGraphBuilderObj Return SetError(0,0,True) EndIf Case 2 if IsArray($MsgGraphArray) Then Local $TempMsgGraphArray[UBound($MsgGraphArray)],$Test = False , $j = 0 For $i = 0 To UBound($MsgGraphArray) - 1 if $IGraphBuilderObj = $MsgGraphArray[$i] Then $Test = True ContinueLoop EndIf $TempMsgGraphArray[$j] = $MsgGraphArray[$i] $j += 1 Next if ($Test) Then if UBound($TempMsgGraphArray) > 1 Then ReDim $TempMsgGraphArray[UBound($TempMsgGraphArray) - 1] $MsgGraphArray = $TempMsgGraphArray Else $MsgGraphArray = 0 EndIf Return SetError(0,0,True) Else Return SetError(2,0,False) EndIf EndIf Case Else Return SetError(3,0,False) EndSwitch EndFunc Func IUnknownRelease($IUnknown) ;-------IUnknown Release Virtual Method Number Is 3;---------------- $Rt = InterfaceCall($IUnknown,"long",3) ;-------IUnknown Release Virtual Method Number Is 3;---------------- if @error Then Return SetError(1,0,0) Return SetError(0,0,$Rt[0]) EndFunc Func GetObjFromGuid($StrIID,$StrCLSID) Local $LSCTX_ALL = BitOR(0x1,0x4,0x16),$Rt = 0 if Not ($CoInitialize) Then $Rt = DllCall($Ole32,"long","CoInitialize","ptr",0) if @error Or ($Rt[0] <> 0 And $Rt[0] <> 1) Then Return SetError(1,0,0) $CoInitialize = True OnAutoItExitRegister("CREATEGRAPH_ON_EXIT") EndIf $clsid = CLSIDFromString($StrCLSID) if @error Then Return SetError(2,0,0) $riid = IIDFromString($StrIID) if @error Then Return SetError(3,0,0) $Rt = DllCall($Ole32,"long","CoCreateInstance","ptr",DllStructGetPtr($clsid), _ "ptr",0,"DWORD",$LSCTX_ALL,"ptr",DllStructGetPtr($riid),"ptr*",0) if @error Or $Rt[0] <> 0 Then Return SetError(4,0,0) Return SetError(0,0,$Rt[5]) EndFuncInterfaceCall.au3 Func InterfaceCall($Inface,$ReturnType,$MethodNum,$Type1 = 0,$Param1 = 0,$Type2 = 0,$Param2 = 0 _ ,$Type3 = 0,$Param3 = 0, $Type4 = 0,$Param4 = 0 ,$Type5 = 0 ,$Param5 = 0,$Type6 = 0,$Param6 = 0 _ ,$Type7 = 0,$Param7 = 0, $Type8 = 0,$Param8 = 0,$Type9 = 0,$Param9 = 0,$Type10 = 0,$Param10 = 0 _ ,$Type11= 0,$Param11= 0,$Type12= 0,$Param12= 0,$Type13= 0,$Param13 = 0,$Type14 = 0,$Param14 = 0 _ ,$Type15= 0,$Param15= 0,$Type16= 0,$Param16= 0,$Type17= 0,$Param17 = 0,$Type18 = 0,$Param18 = 0 _ ,$Type19= 0,$Param19= 0,$Type20= 0,$Param20= 0,$Type21= 0,$Param21 = 0,$Type22 = 0,$Param22 = 0 _ ,$Type23= 0,$Param23= 0,$Type24= 0,$Param24= 0,$Type25= 0,$Param25 = 0,$Type26 = 0,$Param26 = 0 _ ,$Type27= 0,$Param27= 0,$Type28= 0,$Param28= 0,$Type29= 0,$Param29 = 0,$Type30 = 0,$Param30 = 0) ;;Return Array Of DllCallAddress ;Only Call Virtual Method Form any Class Or From any Interface ;$MethodNum ==> Virtual Method Number In (Virtual Methods Table) ;See the examples ;-------------------------------------------------------------------;C++ Example1 ;C++ Example1 ;class iClass ;{ ;public: ;void MethodA() ;{ ;MessageBox(0,"MethodA","MSG",0); ;} ;virtual void VirtualMethodB() ;{ ;MessageBox(0,"VirtualMethodB","MSG",0); ;} ;virtual void VirtualMethodC() ;{ ;MessageBox(0,"VirtualMethodC","MSG",0); ;} ;void MethodB() ;{ ;MessageBox(0,"MethodB","MSG",0); ;} ;virtual void VirtualMethodA() ;{ ;MessageBox(0,"VirtualMethodA","MSG",0); ;} ;}; ;-----------------------------------------------------------;Virtual Methods Table ;Virtual Methods Table ;virtual void VirtualMethodB() ==> Virtual Method Number Is 1 ;virtual void VirtualMethodC() ==> Virtual Method Number Is 2 ;virtual void VirtualMethodA() ==> Virtual Method Number Is 3 ;-----------------------------------------------------------;Virtual Methods Table ;-------------------------------------------------------------------;C++ Example1 ;//////////////////////////////////////////////////////////////////////////////// ;-------------------------------------------------------------------;C++ Example2 ;C++ Example2 ;class iClassA ;{ ;public: ;void MethodA() ;{ ;MessageBox(0,"MethodA","MSG",0); ;} ;virtual void VirtualMethodB() ;{ ;MessageBox(0,"VirtualMethodB","MSG",0); ;} ;virtual void VirtualMethodC() ;{ ;MessageBox(0,"VirtualMethodC","MSG",0); ;} ;}; ;class iClassB : public iClassA ;{ ;public: ;void MethodD() ;{ ;MessageBox(0,"MethodD","MSG",0); ;} ;virtual void VirtualMethodF() ;{ ;MessageBox(0,"VirtualMethodF","MSG",0); ;} ;virtual void VirtualMethodE() ;{ ;MessageBox(0,"VirtualMethodE","MSG",0); ;} ;}; ;//////////////////////////////////////////////////////////////////////////////// ;//////////////////////////////////////////////////////////////////////////////// ;------------------------------------------;Virtual Methods Table Of iClassA Class ;Virtual Methods Table Of iClassA Class ;virtual void VirtualMethodB() ==> Virtual Method Number Is 1 ;virtual void VirtualMethodC() ==> Virtual Method Number Is 2 ;------------------------------------------;Virtual Methods Table Of iClassA Class ;//////////////////////////////////////////////////////////////////////////////// ;/////////////////////////////////////////////////////////////////////////////// ;------------------------------------------;Virtual Methods Table Of iClassB Class ;class iClassB : public iClassA ;base class ==> iClassA ;derived class ==> iClassB ;http://msdn.microsoft.com/en-us/library/hzk8a7d3.aspx ;When preceding the name of a base class, the public keyword specifies that the public ;and protected members of the base class are public and protected members, respectively, ;of the derived class. ;------------------------------------------------------------------------------------- ;Virtual Methods Table Of iClassB Class ;virtual void VirtualMethodB() In (iClassA) ==> Virtual Method Number Is 1 ;virtual void VirtualMethodC() In (iClassA) ==> Virtual Method Number Is 2 ;virtual void VirtualMethodF() In (iClassB) ==> Virtual Method Number Is 3 ;virtual void VirtualMethodE() In (iClassB) ==> Virtual Method Number Is 4 ;------------------------------------------;Virtual Methods Table Of iClassB Class ;-------------------------------------------------------------------;C++ Example2 ;//////////////////////////////////////////////////////////////////////////////// if Not IsPtr($Inface) Or ($MethodNum < 1) Then Return SetError(1,0,0) if (@NumParams > 3) And (Mod((@NumParams - 3),2) <> 0) Then Return SetError(2,0,0) Local $iMethAddress = GetMethodAddress($Inface,$MethodNum) if Not ($iMethAddress) Then Return SetError(3,0,0) Local $iDataType = "",$iFuncParam = "",$iCommand = "",$iReturn = 0 ;Why use Inface Param In DllCallAddress Function Because the Function of the method ;starts from the (Interface Or class) ;See here ;int class::MethodFunction( int Param ){return 0;}; $iCommand = 'DllCallAddress("' & $ReturnType & '",Eval("iMethAddress"),"ptr",Eval("Inface"),' For $i = 1 To ((@NumParams - 3) / 2) $iDataType = Eval("Type" & $i) $iCommand &= '"' & $iDataType & '",' $iFuncParam = 'Eval("Param' & $i & '"),' $iCommand &= $iFuncParam Next $iCommand = StringTrimRight($iCommand,1) $iCommand &= ")" $iReturn = Execute($iCommand) if @error Then Return SetError(4,0,0) Local $nReturn[UBound($iReturn) -1] , $j = 0 For $i = 0 To UBound($iReturn) - 1 if ($i = 1) Then ContinueLoop ;Skip $Inface Element $nReturn[$j] = $iReturn[$i] $j += 1 Next Return SetError(0,0,$nReturn) EndFunc Func GetMethodAddress($Inface,$MethodNum) ;$MethodNum ==> Virtual Method Number In (Virtual Methods Table) Local $SizeOfUlong_Ptr = 4,$iMethAddress = 0,$OutCastStruct1 = 0 Local $OutCast1 = 0 , $OutCastStruct2 = 0 if Not IsPtr($Inface) Or ($MethodNum < 1) Then Return SetError(1,0,0) ;------------------------------------------------------- $OutCastStruct1 = DllStructCreate("ULONG_PTR",$Inface) $OutCast1 = DllStructGetData($OutCastStruct1,1) ;In C++ ==> unsigned long** OutCast1 = *(unsigned long***)Inface; ;-------------------------------------------------------- ;------------------------------------------------------- $OutCastStruct2 = DllStructCreate("ULONG_PTR",$OutCast1 + ($SizeOfUlong_Ptr * ($MethodNum - 1))) $iMethAddress = DllStructGetData($OutCastStruct2,1) ;$OutCast1 + ($SizeOfUlong_Ptr * ($MethodNum - 1)) ==> $OutCast1 Is PTR Array Of Virtual Methods Table // Method PTR = Array[MethodNum - 1] ;In C++ ==> unsigned long* iMethAddress = *(unsigned long**)((BYTE*)OutCast1 + (SizeOfUlong_Ptr * (MethodNum - 1))); ;Or In C++ ==> unsigned long* iMethAddress = OutCast1[MethodNum - 1]; ;-------------------------------------------------------- if (IsBadCodePtr($iMethAddress)) Then Return SetError(2,0,0) Return SetError(0,0,$iMethAddress) EndFunc Func GetCount_Of_VirtualMethods($Inface) Local $SizeOfUlong_Ptr = 4,$iMethAddress = 0,$OutCastStruct1 = 0 Local $OutCast1 = 0 , $OutCastStruct2 = 0 , $MethodNum = 1 if Not IsPtr($Inface) Then Return SetError(1,0,0) ;------------------------------------------------------- $OutCastStruct1 = DllStructCreate("ULONG_PTR",$Inface) $OutCast1 = DllStructGetData($OutCastStruct1,1) ;In C++ ==> unsigned long** OutCast1 = *(unsigned long***)Inface; ;-------------------------------------------------------- While 1 ;------------------------------------------------------- $OutCastStruct2 = DllStructCreate("ULONG_PTR",DllStructGetData($OutCastStruct1,1) + ($SizeOfUlong_Ptr * ($MethodNum - 1))) $iMethAddress = DllStructGetData($OutCastStruct2,1) ;$OutCast1 + ($SizeOfUlong_Ptr * ($MethodNum - 1)) ==> $OutCast1 Is PTR Array Of Virtual Methods Table // Method PTR = Array[MethodNum - 1] ;In C++ ==> unsigned long* iMethAddress = *(unsigned long**)((BYTE*)OutCast1 + (SizeOfUlong_Ptr * (MethodNum - 1))); ;Or In C++ ==> unsigned long* iMethAddress = OutCast1[MethodNum - 1]; ;-------------------------------------------------------- if (IsBadCodePtr($iMethAddress)) Then $MethodNum -= 1 ExitLoop Else $MethodNum += 1 EndIf WEnd Return SetError(0,0,$MethodNum) EndFunc Func IsBadCodePtr($lpfn) Local $iReturn $iReturn = DllCall("Kernel32.dll","BOOL","IsBadCodePtr","ptr",$lpfn) if @error Then Return SetError(1,0,0) Return SetError(0,0,$iReturn[0]) EndFunc Func CLSIDFromString($psz) $GUID = DllStructCreate("ulong Data1;ushort Data2;ushort Data3;byte Data4[8]") $Oleerror = DllCall("Ole32.dll","int","CLSIDFromString","WSTR",$psz,"struct*",$GUID) if @error Or $Oleerror[0] <> 0 Then Return SetError(1,0,0) Return SetError(0,0,$Oleerror[2]) EndFunc Func IIDFromString($psz) $GUID = DllStructCreate("ulong Data1;ushort Data2;ushort Data3;byte Data4[8]") $Oleerror = DllCall("Ole32.dll","int","IIDFromString","WSTR",$psz,"struct*",$GUID) if @error Or $Oleerror[0] <> 0 Then Return SetError(1,0,0) Return SetError(0,0,$Oleerror[2]) EndFuncVideoExample.au3 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "DirectShow.au3" $hGui = GUICreate("DirectShow Example",500,390) $Run = GUICtrlCreateButton("Run",10,320,100,50) $Pause = GUICtrlCreateButton("Pause",120,320,100,50) $Stop = GUICtrlCreateButton("Stop",230,320,100,50) $FileOpen = GUICtrlCreateButton("FileOpen ",340,320,100,50) GUISetState() $IGraphBuilder = GUICtrlCreateGraph($hGui,"Video.mpg",10,10,480,300) While True $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE Exit Case $iMsg = $Run IMediaControl_Run($IGraphBuilder) Case $iMsg = $Pause IMediaControl_Pause($IGraphBuilder) Case $iMsg = $Stop IMediaControl_Stop($IGraphBuilder) Case $iMsg = $FileOpen $var = FileOpenDialog("", @MyDocumentsDir & "\", _ "Video(*.avi;*.qt;*.mov;*.mpg;mpeg*.m1v;*.wmv)|Images(*.gif;*.jpg;*.bmp)|All(*.*)", 1 + 4) if Not @error Then if Not ($IGraphBuilder) Then $IGraphBuilder = GUICtrlCreateGraph($hGui,$var,10,10,480,300) Else Re_GUICtrlCreateGraph($IGraphBuilder,$var) ;ByRef $IGraphBuilder EndIf EndIf EndSelect WEndImageExample.au3 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "DirectShow.au3" $hGui = GUICreate("DirectShow Example",500,390) $Run = GUICtrlCreateButton("Run",10,320,100,50) $Pause = GUICtrlCreateButton("Pause",120,320,100,50) $Stop = GUICtrlCreateButton("Stop",230,320,100,50) $FileOpen = GUICtrlCreateButton("FileOpen ",340,320,100,50) GUISetState() $IGraphBuilder = GUICtrlCreateGraph($hGui,"Image.gif",10,10,480,300) While True $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE Exit Case $iMsg = $Run IMediaControl_Run($IGraphBuilder) Case $iMsg = $Pause IMediaControl_Pause($IGraphBuilder) Case $iMsg = $Stop IMediaControl_Stop($IGraphBuilder) Case $iMsg = $FileOpen $var = FileOpenDialog("", @MyDocumentsDir & "\", _ "Images(*.gif;*.jpg;*.bmp)|Videos(*.avi;*.qt;*.mov;*.mpg;mpeg*.m1v)|" & _ "All(*.*)", 1 + 4) if Not @error Then if Not ($IGraphBuilder) Then $IGraphBuilder = GUICtrlCreateGraph($hGui,$var,10,10,480,300) Else Re_GUICtrlCreateGraph($IGraphBuilder,$var) ;ByRef $IGraphBuilder EndIf EndIf EndSelect WEndAudioExample.au3 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "DirectShow.au3" $hGui = GUICreate("DirectShow Example",500,250) $Run = GUICtrlCreateButton("Run",10 + 20,105,100,50) $Pause = GUICtrlCreateButton("Pause",120 + 20,105,100,50) $Stop = GUICtrlCreateButton("Stop",230 + 20,105,100,50) $FileOpen = GUICtrlCreateButton("FileOpen ",340 + 20,105,100,50) GUISetState() $IGraphBuilder = CtrlCreateAudio($hGui,"Audio.mid") While True $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE Exit Case $iMsg = $Run IMediaControl_Run($IGraphBuilder) Case $iMsg = $Pause IMediaControl_Pause($IGraphBuilder) Case $iMsg = $Stop IMediaControl_Stop($IGraphBuilder) Case $iMsg = $FileOpen $var = FileOpenDialog("", @MyDocumentsDir & "\", _ "Audio(*.mid;*.midi;*.rmi;*.wav;*.mpa;*.mp2;*.mp3;*.au;*.aif;*.aiff;*.snd)|All(*.*)", 1 + 4) if Not @error Then if ($IGraphBuilder) Then CtrlDeleteAudio($IGraphBuilder) ;ByRef $IGraphBuilder $IGraphBuilder = CtrlCreateAudio($hGui,$var) EndIf EndSelect WEnd
    2 points
  2. Hi! Today I want to show you my current AutoIt project: The ISN AutoIt Studio. The ISN AutoIt Studio is a complete IDE made with AutoIt, for AutoIt! It includes a GUI designer, a code editor (with syntax highlighting, auto complete & intelisense), a file viewer, a backup system, trophies and a lot more features!! Here are some screenshots: Here some higlights: -> easy to create/manage/public your AutoIt-projects! ->integrated GUI-Editor (ISN Form Studio 2) ->integrated - file & projectmanager ->auto backupfunction for your Projects ->extendable with plugins! ->available in several languages ->trophies ->Syntax highlighting /Autocomplete / Intelisense ->Dynamic Script ->detailed overview of the project (total working hours, total size...) And much more!!! -> -> Click here to download ISN AutoIt Studio <- <- Here is the link to the german autoit forum where I posted ISN AutoIt Studio the first time: http://autoit.de/index.php?page=Thread&threadID=29742&pageNo=1 For more information visit my Homepage: https://www.isnetwork.at So….have fun with ISN AutoIt Studio! PS: Sorry for my bad English! ^^
    1 point
  3. looks beautiful, and I like it very much. But I need the standard menu style with icon support on my new application. I search on the forums but I can't find a complete solution works both under XP and Win7. So I wrote one. The screenshot says everything This UDF has only two key functions: _GUICtrlMenuEx_Startup() and _GUICtrlMenuEx_SetItemIcon(). But for convenient to use, _GUICtrlMenuEx_AddMenuItem() and _GUICtrlMenuEx_InsertMenuItem() warp the standard UDF and accept similar parameters except the icon handle. There are also two convenient functions to add menu bar more quickly (_GUICtrlMenuEx_AddMenuBar() and _GUICtrlMenuEx_InsertMenuBar()). See the example for detail usage. Technical speaking, this UDF use the MSDN suggested method to convert an icon to bitmap. Another simple way discussed before on the forums is to use GdipCreateBitmapFromHICON. But this function seems poor support to alpha channel icon. So I choose the MSDN's way. Complete code in __GUICtrlMenuEx_CreateBitmapFromIcon_Vista(). It was converted from MSDN's CVistaMenuApp.cpp. Have a nice day ! GUICtrlMenuEx.zip (3.89K) Number of downloads: 58 2010/12/16 Update Note: #Better windows version detect (Thanks to Mat, wraithdu) #A bug about redraw icon (Typing error in PaintParams structure) #DLL path problem in example (Thanks to Raupi) GUICtrlMenuEx.zip
    1 point
  4. wolf9228

    DirectShow

    Thanks DirectShow.au3 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "InterfaceCall.au3" Global $CoInitialize = False , $Ole32 = DllOpen("Ole32.dll"),$MsgGraphArray = 0,$StartGraph = 0 Const $WM_GRAPHNOTIFY = $WM_APP + 1 ;Video Files (avi|qt|mov|mpg|mpeg|m1v|wmv) ;Audio files (wav|mpa|mp2|mp3|au|aif|aiff|snd) ;MIDI Files (mid|midi|rmi) ;Image Files (jpg|bmp|gif) ;And Other Func GUICtrlCreateGraph($Gui,$FileName,$L,$T,$W,$H,$Style = -1,$ExStyle = -1,$Run = True) ;$FileName the name of a media file if $Style = -1 Then $Style = BitOR($WS_CHILD,$WS_CLIPCHILDREN,$WS_CLIPSIBLINGS) if $ExStyle = -1 Then $ExStyle = 0 $StrIID_IGraphBuilder = "{56a868a9-0ad4-11ce-b03a-0020af0ba770}" $StrCLSID_FilterGraph = "{e436ebb3-524f-11ce-9f53-0020af0ba770}" $NewIGraphBuilder = GetObjFromGuid($StrIID_IGraphBuilder,$StrCLSID_FilterGraph) if @error Then Return SetError(1,0,0) if $StartGraph = 0 Then GUIRegisterMsg($WM_GRAPHNOTIFY,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_ERASEBKGND,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_ACTIVATEAPP,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_DEVMODECHANGE,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_DISPLAYCHANGE,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_PALETTECHANGED,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_PALETTEISCHANGING,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_QUERYNEWPALETTE,"CREATEGRAPH_WM_MSG") $StartGraph = 1 ElseIf $StartGraph = 2 Then GUIRegisterMsg($WM_ERASEBKGND,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_ACTIVATEAPP,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_DEVMODECHANGE,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_DISPLAYCHANGE,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_PALETTECHANGED,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_PALETTEISCHANGING,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_QUERYNEWPALETTE,"CREATEGRAPH_WM_MSG") GUIRegisterMsg($WM_SYSCOLORCHANGE,"CREATEGRAPH_WM_MSG") EndIf Add_Remove_MsgGraphArray($NewIGraphBuilder) ; Add ;-------IGraphBuilder RenderFile Virtual Method Number Is 14;---------------- $Rt = InterfaceCall($NewIGraphBuilder,"long",14,"wstr",$FileName,"ptr",0) if @error Or $Rt[0] <> 0 Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove CtrlGraphRelease($NewIGraphBuilder) Return SetError(2,0,0) EndIf ;-------IGraphBuilder RenderFile Virtual Method Number Is 14;---------------- $IVideoWindow = GetIVideoWindow($NewIGraphBuilder) if @error Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove CtrlGraphRelease($NewIGraphBuilder) Return SetError(3,0,0) EndIf $IMediaEventEx = GetIMediaEventEx($NewIGraphBuilder) if @error Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove CtrlGraphRelease($NewIGraphBuilder,$IVideoWindow) Return SetError(4,0,0) EndIf ;-------IMediaEventEx SetNotifyWindow Virtual Method Number Is 14;---------------- $Rt = InterfaceCall($IMediaEventEx,"long",14,"ptr",$Gui,"long",$WM_GRAPHNOTIFY,"ptr",0) if @error Or $Rt[0] <> 0 Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove CtrlGraphRelease($NewIGraphBuilder,$IVideoWindow,$IMediaEventEx) Return SetError(5,0,0) EndIf ;-------IMediaEventEx SetNotifyWindow Virtual Method Number Is 14;---------------- ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- $Rt = InterfaceCall($IVideoWindow,"long",30,"ptr",$Gui) if @error Or $Rt[0] <> 0 Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove CtrlGraphRelease($NewIGraphBuilder,$IVideoWindow,$IMediaEventEx) Return SetError(6,0,0) EndIf ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- ;-------IVideoWindow put_MessageDrain Virtual Method Number Is 32;---------------- $Rt = InterfaceCall($IVideoWindow,"long",32,"ptr",$Gui) if @error Or $Rt[0] <> 0 Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove CtrlGraphRelease($NewIGraphBuilder,$IVideoWindow,$IMediaEventEx) Return SetError(7,0,0) EndIf ;-------IVideoWindow put_MessageDrain Virtual Method Number Is 32;---------------- ;-------IVideoWindow SetWindowPosition Virtual Method Number Is 40;---------------- $Rt = InterfaceCall($IVideoWindow,"long",40,"long",$L,"long",$T,"long",$W,"long",$H) if @error Or $Rt[0] <> 0 Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- $Rt = InterfaceCall($IVideoWindow,"long",30,"ptr",0) ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- CtrlGraphRelease($NewIGraphBuilder,$IVideoWindow,$IMediaEventEx) Return SetError(8,0,0) EndIf ;-------IVideoWindow SetWindowPosition Virtual Method Number Is 40;---------------- ;-------IVideoWindow put_WindowStyle Virtual Method Number Is 10;---------------- $Rt = InterfaceCall($IVideoWindow,"long",10,"long",$Style) if @error Or $Rt[0] <> 0 Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- $Rt = InterfaceCall($IVideoWindow,"long",30,"ptr",0) ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- CtrlGraphRelease($NewIGraphBuilder,$IVideoWindow,$IMediaEventEx) Return SetError(9,0,0) EndIf ;-------IVideoWindow put_WindowStyle Virtual Method Number Is 10;---------------- ;-------IVideoWindow put_WindowStyleEx Virtual Method Number Is 12;---------------- $Rt = InterfaceCall($IVideoWindow,"long",12,"long",$ExStyle) if @error Or $Rt[0] <> 0 Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- $Rt = InterfaceCall($IVideoWindow,"long",30,"ptr",0) ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- CtrlGraphRelease($NewIGraphBuilder,$IVideoWindow,$IMediaEventEx) Return SetError(10,0,0) EndIf ;-------IVideoWindow put_WindowStyleEx Virtual Method Number Is 12;---------------- ;-------IVideoWindow put_AutoShow Virtual Method Number Is 14;---------------- $Rt = InterfaceCall($IVideoWindow,"long",14,"long",-1) if @error Or $Rt[0] <> 0 Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- $Rt = InterfaceCall($IVideoWindow,"long",30,"ptr",0) ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- CtrlGraphRelease($NewIGraphBuilder,$IVideoWindow,$IMediaEventEx) Return SetError(11,0,0) EndIf ;-------IVideoWindow put_AutoShow Virtual Method Number Is 14;---------------- if ($Run) Then IMediaControl_Run($NewIGraphBuilder) EndIf CtrlGraphRelease($IVideoWindow,$IMediaEventEx) Return SetError(0,0,$NewIGraphBuilder) EndFunc Func Re_GUICtrlCreateGraph(ByRef $OutIGraphBuilder,$FileName,$Run = True) $IVideoWindow = GetIVideoWindow($OutIGraphBuilder) if @error Then Return SetError(1,0,False) $IMediaEventEx = GetIMediaEventEx($OutIGraphBuilder) if @error Then Return SetError(2,0,False) ;-------IVideoWindow get_WindowStyle Virtual Method Number Is 11;---------------- $Rt = InterfaceCall($IVideoWindow,"long",11,"long*",0) if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow,$IMediaEventEx) Return SetError(3,0,False) EndIf $Style = $Rt[1] ;-------IVideoWindow get_WindowStyle Virtual Method Number Is 11;---------------- ;-------IVideoWindow get_WindowStyleEx Virtual Method Number Is 13;---------------- $Rt = InterfaceCall($IVideoWindow,"long",13,"long*",0) if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow,$IMediaEventEx) Return SetError(4,0,False) EndIf $ExStyle = $Rt[1] ;-------IVideoWindow get_WindowStyleEx Virtual Method Number Is 13;---------------- ;-------IVideoWindow get_Owner Virtual Method Number Is 31;---------------- $Rt = InterfaceCall($IVideoWindow,"long",31,"ptr*",0) if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow,$IMediaEventEx) Return SetError(5,0,False) EndIf $Gui = $Rt[1] ;-------IVideoWindow get_Owner Virtual Method Number Is 31;---------------- ;-------IVideoWindow GetRestorePosition Virtual Method Number Is 44;---------------- $Rt = InterfaceCall($IVideoWindow,"long",44,"long*",0,"long*",0,"long*",0,"long*",0) if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow,$IMediaEventEx) Return SetError(6,0,False) EndIf $L = $Rt[1] $T = $Rt[2] $W = $Rt[3] $H = $Rt[4] ;-------IVideoWindow GetRestorePosition Virtual Method Number Is 44;------------ $RtIGraphBuilder = GUICtrlCreateGraph($Gui,$FileName,$L,$T,$W,$H,$Style,$ExStyle,$Run) if @error Then CtrlGraphRelease($IVideoWindow,$IMediaEventEx) Return SetError(7,0,False) Else IMediaControl_Stop($OutIGraphBuilder) Add_Remove_MsgGraphArray($OutIGraphBuilder,2) ; Remove ;-------IMediaEventEx SetNotifyWindow Virtual Method Number Is 14;---------------- $Rt = InterfaceCall($IMediaEventEx,"long",14,"ptr",0,"long",0,"ptr",0) ;-------IMediaEventEx SetNotifyWindow Virtual Method Number Is 14;---------------- ;-------IVideoWindow put_Visible Virtual Method Number Is 20;---------------- $Rt = InterfaceCall($IVideoWindow,"long",20,"long",0) ;-------IVideoWindow put_Visible Virtual Method Number Is 20;---------------- ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- $Rt = InterfaceCall($IVideoWindow,"long",30,"ptr",0) ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- CtrlGraphRelease($OutIGraphBuilder,$IVideoWindow,$IMediaEventEx) $OutIGraphBuilder = $RtIGraphBuilder EndIf Return SetError(0,0,True) EndFunc Func GUICtrlDeleteGraph(ByRef $OutIGraphBuilder) $IVideoWindow = GetIVideoWindow($OutIGraphBuilder) if @error Then Return SetError(1,0,False) $IMediaEventEx = GetIMediaEventEx($OutIGraphBuilder) if @error Then Return SetError(2,0,False) IMediaControl_Stop($OutIGraphBuilder) Add_Remove_MsgGraphArray($OutIGraphBuilder,2) ; Remove ;-------IMediaEventEx SetNotifyWindow Virtual Method Number Is 14;---------------- $Rt = InterfaceCall($IMediaEventEx,"long",14,"ptr",0,"long",0,"ptr",0) ;-------IMediaEventEx SetNotifyWindow Virtual Method Number Is 14;---------------- ;-------IVideoWindow put_Visible Virtual Method Number Is 20;---------------- $Rt = InterfaceCall($IVideoWindow,"long",20,"long",0) ;-------IVideoWindow put_Visible Virtual Method Number Is 20;---------------- ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- $Rt = InterfaceCall($IVideoWindow,"long",30,"ptr",0) ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- CtrlGraphRelease($IVideoWindow,$OutIGraphBuilder,$IMediaEventEx) $OutIGraphBuilder = 0 Return SetError(0,0,True) EndFunc Func CtrlCreateAudio($Gui,$FileName,$Run = True) ;$FileName the name of a media file $StrIID_IGraphBuilder = "{56a868a9-0ad4-11ce-b03a-0020af0ba770}" $StrCLSID_FilterGraph = "{e436ebb3-524f-11ce-9f53-0020af0ba770}" $NewIGraphBuilder = GetObjFromGuid($StrIID_IGraphBuilder,$StrCLSID_FilterGraph) if @error Then Return SetError(1,0,0) if $StartGraph = 0 Then GUIRegisterMsg($WM_GRAPHNOTIFY,"CREATEGRAPH_WM_MSG") $StartGraph = 2 EndIf Add_Remove_MsgGraphArray($NewIGraphBuilder) ; Add ;-------IGraphBuilder RenderFile Virtual Method Number Is 14;---------------- $Rt = InterfaceCall($NewIGraphBuilder,"long",14,"wstr",$FileName,"ptr",0) if @error Or $Rt[0] <> 0 Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove CtrlGraphRelease($NewIGraphBuilder) Return SetError(2,0,0) EndIf ;-------IGraphBuilder RenderFile Virtual Method Number Is 14;---------------- $IMediaEventEx = GetIMediaEventEx($NewIGraphBuilder) if @error Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove CtrlGraphRelease($NewIGraphBuilder) Return SetError(3,0,0) EndIf ;-------IMediaEventEx SetNotifyWindow Virtual Method Number Is 14;---------------- $Rt = InterfaceCall($IMediaEventEx,"long",14,"ptr",$Gui,"long",$WM_GRAPHNOTIFY,"ptr",0) if @error Or $Rt[0] <> 0 Then Add_Remove_MsgGraphArray($NewIGraphBuilder,2) ; Remove CtrlGraphRelease($NewIGraphBuilder,$IMediaEventEx) Return SetError(4,0,0) EndIf ;-------IMediaEventEx SetNotifyWindow Virtual Method Number Is 14;---------------- if ($Run) Then IMediaControl_Run($NewIGraphBuilder) EndIf CtrlGraphRelease($IMediaEventEx) Return SetError(0,0,$NewIGraphBuilder) EndFunc Func CtrlDeleteAudio(ByRef $OutIGraphBuilder) $IMediaEventEx = GetIMediaEventEx($OutIGraphBuilder) if @error Then Return SetError(1,0,False) $State = IMediaControl_GetState($OutIGraphBuilder) if @error Then Return SetError(2,0,False) if $State = 2 Or $State = 1 Then IMediaControl_Stop($OutIGraphBuilder) EndIf ;-------IMediaEventEx SetNotifyWindow Virtual Method Number Is 14;---------------- $Rt = InterfaceCall($IMediaEventEx,"long",14,"ptr",0,"long",0,"ptr",0) ;-------IMediaEventEx SetNotifyWindow Virtual Method Number Is 14;---------------- Add_Remove_MsgGraphArray($OutIGraphBuilder,2) ; Remove CtrlGraphRelease($OutIGraphBuilder,$IMediaEventEx) $OutIGraphBuilder = 0 Return SetError(0,0,True) EndFunc Func GetIVideoWindow($IGraphBuilder) $IID_IVideoWindow = IIDFromString("{56a868b4-0ad4-11ce-b03a-0020af0ba770}") if @error Then Return SetError(1,0,0) ;---------IUnknown QueryInterface Virtual Method Number Is 1;------------------- $Rt = InterfaceCall($IGraphBuilder,"long",1,"struct*",$IID_IVideoWindow,"ptr*",0) ;---------IUnknown QueryInterface Virtual Method Number Is 1;------------------- if @error Or $Rt[0] <> 0 Then Return SetError(2,0,0) Return SetError(0,0,$Rt[2]) EndFunc Func GetIMediaControl($IGraphBuilder) $IID_IMediaControl = IIDFromString("{56a868b1-0ad4-11ce-b03a-0020af0ba770}") if @error Then Return SetError(1,0,0) ;---------IUnknown QueryInterface Virtual Method Number Is 1;------------------- $Rt = InterfaceCall($IGraphBuilder,"long",1,"struct*",$IID_IMediaControl,"ptr*",0) ;---------IUnknown QueryInterface Virtual Method Number Is 1;------------------- if @error Or $Rt[0] <> 0 Then Return SetError(2,0,0) Return SetError(0,0,$Rt[2]) EndFunc Func GetIMediaSeeking($IGraphBuilder) $IID_IMediaSeeking = IIDFromString("{36b73880-c2c8-11cf-8b46-00805f6cef60}") if @error Then Return SetError(1,0,0) ;---------IUnknown QueryInterface Virtual Method Number Is 1;------------------- $Rt = InterfaceCall($IGraphBuilder,"long",1,"struct*",$IID_IMediaSeeking,"ptr*",0) ;---------IUnknown QueryInterface Virtual Method Number Is 1;------------------- if @error Or $Rt[0] <> 0 Then Return SetError(2,0,0) Return SetError(0,0,$Rt[2]) EndFunc Func GetIMediaEventEx($IGraphBuilder) $IID_IMediaEventEx = IIDFromString("{56a868c0-0ad4-11ce-b03a-0020af0ba770}") if @error Then Return SetError(1,0,0) ;---------IUnknown QueryInterface Virtual Method Number Is 1;------------------- $Rt = InterfaceCall($IGraphBuilder,"long",1,"struct*",$IID_IMediaEventEx,"ptr*",0) ;---------IUnknown QueryInterface Virtual Method Number Is 1;------------------- if @error Or $Rt[0] <> 0 Then Return SetError(2,0,0) Return SetError(0,0,$Rt[2]) EndFunc Func CREATEGRAPH_WM_MSG($hWnd,$Msg,$wParam,$lParam) if IsArray($MsgGraphArray) Then For $i = 0 To UBound($MsgGraphArray) - 1 Switch $Msg Case $WM_GRAPHNOTIFY Local $EC_COMPLETE = 0x01 $IMediaEventEx = GetIMediaEventEx($MsgGraphArray[$i]) if Not @error Then ;-------IMediaEventEx GetEvent Virtual Method Number Is 9;---------------- $Rt = InterfaceCall($IMediaEventEx,"long",9,"Long*",0,"LONG_PTR*",0,"LONG_PTR*",0,"long",100) ;-------IMediaEventEx GetEvent Virtual Method Number Is 9;---------------- if Not @error And $Rt[0] = 0 Then $lEventCode = $Rt[1] $lParam1 = $Rt[2] $lParam2 = $Rt[3] if $lEventCode = $EC_COMPLETE Then IMediaControl_StopWhenReady($MsgGraphArray[$i]) EndIf ;-------IMediaEventEx FreeEventParams Virtual Method Number Is 13;---------------- InterfaceCall($IMediaEventEx,"long",13,"Long",$lEventCode,"LONG_PTR",$lParam1,"LONG_PTR",$lParam2) ;-------IMediaEventEx FreeEventParams Virtual Method Number Is 13;---------------- EndIf EndIf Case $WM_ERASEBKGND $IVideoWindow = GetIVideoWindow($MsgGraphArray[$i]) if Not @error Then ;-------IVideoWindow put_BackgroundPalette Virtual Method Number Is 18;---------------- ;The put_BackgroundPalette method specifies whether the video window realizes its palette ;in the background. ;BackgroundPalette [in] ;Specifies whether the video renderer realizes it palette in the background. Must be one of ;the following values: ;Value Description ;OATRUE = -1 The video renderer realizes the palette in the background. ;OAFALSE = 0 The video renderer does not realize the palette in the background. (Default.) Local $BackgroundPalette = -1 $Rt = InterfaceCall($IVideoWindow,"long",18,"long",$BackgroundPalette) ;-------IVideoWindow put_BackgroundPalette Virtual Method Number Is 18;---------------- CtrlGraphRelease($IVideoWindow) ; No Return EndIf Case Else $IVideoWindow = GetIVideoWindow($MsgGraphArray[$i]) if Not @error Then ;-------IVideoWindow NotifyOwnerMessage Virtual Method Number Is 39;---------------- InterfaceCall($IVideoWindow,"long",39,"ptr",$hWnd,"long",$Msg,"long",$wParam,"long",$lParam) ;-------IVideoWindow NotifyOwnerMessage Virtual Method Number Is 39;---------------- CtrlGraphRelease($IVideoWindow) Return $GUI_RUNDEFMSG EndIf EndSwitch Next EndIf EndFunc Func CREATEGRAPH_ON_EXIT() DllCall($Ole32,"long","CoUninitialize") DllClose($Ole32) EndFunc Func IMediaSeeking_SeekToCurrent($IGraphBuilder) ;-------IMediaSeeking SetPositions Virtual Method Number Is 15;---------------- $IMediaSeeking = GetIMediaSeeking($IGraphBuilder) if @error Then Return SetError(1,0,False) $Rt = InterfaceCall($IMediaSeeking,"long",15,"INT64*",0,"DWORD",0x1,"INT64*",0,"DWORD",0) ;-------IMediaSeeking SetPositions Virtual Method Number Is 15;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IMediaSeeking) Return SetError(2,0,False) EndIf IMediaControl_Stop($IGraphBuilder) CtrlGraphRelease($IMediaSeeking) Return SetError(0,0,True) EndFunc Func IMediaControl_Run($IGraphBuilder) $IMediaControl = GetIMediaControl($IGraphBuilder) if @error Then Return SetError(1,0,False) $State = IMediaControl_GetState($IGraphBuilder) if @error Then Return SetError(2,0,False) if $State = 2 Then IMediaControl_Stop($IGraphBuilder) if @error Then Return SetError(3,0,False) EndIf if $State = 2 Or $State = 0 Then IMediaSeeking_SeekToCurrent($IGraphBuilder) if @error Then Return SetError(4,0,False) EndIf ;-------IMediaControl Run Virtual Method Number Is 8;---------------- $Rt = InterfaceCall($IMediaControl,"long",8) ;-------IMediaControl Run Virtual Method Number Is 8;---------------- if @error Or $Rt[0] <> 1 Then CtrlGraphRelease($IMediaControl) Return SetError(5,0,False) EndIf CtrlGraphRelease($IMediaControl) Return SetError(0,0,True) EndFunc Func IMediaControl_Pause($IGraphBuilder) $IMediaControl = GetIMediaControl($IGraphBuilder) if @error Then Return SetError(1,0,False) ;-------IMediaControl Pause Virtual Method Number Is 9;---------------- $Rt = InterfaceCall($IMediaControl,"long",9) ;-------IMediaControl Pause Virtual Method Number Is 9;---------------- if @error Or $Rt[0] <> 1 Then CtrlGraphRelease($IMediaControl) Return SetError(2,0,False) EndIf Return SetError(0,0,True) EndFunc Func IMediaControl_Stop($IGraphBuilder) $IMediaControl = GetIMediaControl($IGraphBuilder) if @error Then Return SetError(1,0,False) ;-------IMediaControl Stop Virtual Method Number Is 10;---------------- $Rt = InterfaceCall($IMediaControl,"long",10) ;-------IMediaControl Stop Virtual Method Number Is 10;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IMediaControl) Return SetError(2,0,False) EndIf CtrlGraphRelease($IMediaControl) Return SetError(0,0,True) EndFunc Func IMediaControl_StopWhenReady($IGraphBuilder) $IMediaControl = GetIMediaControl($IGraphBuilder) if @error Then Return SetError(1,0,False) ;-------IMediaControl StopWhenReady Virtual Method Number Is 16;---------------- $Rt = InterfaceCall($IMediaControl,"long",16) ;-------IMediaControl StopWhenReady Virtual Method Number Is 16;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IMediaControl) Return SetError(2,0,False) EndIf CtrlGraphRelease($IMediaControl) Return SetError(0,0,True) EndFunc Func IMediaControl_GetState($IGraphBuilder) ;enum _FilterState ;{ State_Stopped = 0, ;State_Paused = State_Stopped + 1, ;State_Running = State_Paused + 1 ;} FILTER_STATE; $IMediaControl = GetIMediaControl($IGraphBuilder) if @error Then Return SetError(1,0,-1) ;-------IMediaControl GetState Virtual Method Number Is 11;---------------- $Rt = InterfaceCall($IMediaControl,"long",11,"long",1000,"long*",0) ;-------IMediaControl GetState Virtual Method Number Is 11;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IMediaControl) Return SetError(2,0,-1) EndIf CtrlGraphRelease($IMediaControl) Return SetError(0,0,$Rt[2]) EndFunc Func IVideoWindow_put_Owner($IGraphBuilder,$Gui) $IVideoWindow = GetIVideoWindow($IGraphBuilder) if @error Then Return SetError(1,0,False) ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- $Rt = InterfaceCall($IVideoWindow,"long",30,"ptr",$Gui) ;-------IVideoWindow put_Owner Virtual Method Number Is 30;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow) Return SetError(2,0,False) EndIf CtrlGraphRelease($IVideoWindow) Return SetError(0,0,True) EndFunc Func IVideoWindow_SetWindowPosition($IGraphBuilder,$L,$T,$W,$H) $IVideoWindow = GetIVideoWindow($IGraphBuilder) if @error Then Return SetError(1,0,False) ;-------IVideoWindow SetWindowPosition Virtual Method Number Is 40;---------------- $Rt = InterfaceCall($IVideoWindow,"long",40,"long",$L,"long",$T,"long",$W,"long",$H) ;-------IVideoWindow SetWindowPosition Virtual Method Number Is 40;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow) Return SetError(2,0,False) EndIf CtrlGraphRelease($IVideoWindow) Return SetError(0,0,True) EndFunc Func IVideoWindow_put_WindowState($IGraphBuilder,$WindowState) $IVideoWindow = GetIVideoWindow($IGraphBuilder) if @error Then Return SetError(1,0,False) ;The put_WindowState method shows, hides, minimizes, or maximizes the video window. ;WindowState ;Flag that specifies how the window is to be shown. The value can be any ;constant defined for the nCmdShow parameter of the ShowWindow function. ;-------IVideoWindow put_WindowState Virtual Method Number Is 16;---------------- $Rt = InterfaceCall($IVideoWindow,"long",16,"long",$WindowState) ;-------IVideoWindow Sput_WindowState Virtual Method Number Is 16;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow) Return SetError(2,0,False) EndIf CtrlGraphRelease($IVideoWindow) Return SetError(0,0,True) EndFunc Func IVideoWindow_put_FullScreenMode($IGraphBuilder,$FullScreenMode) $IVideoWindow = GetIVideoWindow($IGraphBuilder) if @error Then Return SetError(1,0,False) ;Sets a hotkey that calls a user function. ;HotKeySet("{ESC}", "HotKeyFullScreenMode") ;Func HotKeyFullScreenMode() ;IVideoWindow_put_FullScreenMode($IGraphBuilder,$FullScreenMode) ;EndFunc ;The put_FullScreenMode method enables or disables full-screen video rendering. ;FullScreenMode [in] ;Boolean value that specifies whether to enable or disable full-screen mode. Must be one ;of the following values: ;Value Description ;OATRUE = -1 Switch to full-screen mode. ;OAFALSE = 0 Disable full-screen mode. (Default.) ;-------IVideoWindow put_FullScreenMode Virtual Method Number Is 37;---------------- $Rt = InterfaceCall($IVideoWindow,"long",37,"long",$FullScreenMode) ;-------IVideoWindow put_FullScreenMode Virtual Method Number Is 37;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow) Return SetError(2,0,False) EndIf CtrlGraphRelease($IVideoWindow) Return SetError(0,0,True) EndFunc Func IVideoWindow_HideCursor($IGraphBuilder,$HideCursor) $IVideoWindow = GetIVideoWindow($IGraphBuilder) if @error Then Return SetError(1,0,False) ;The SetWindowForeground method places the video window at the top of the Z order. ;HideCursor [in] ;Specifies whether to show or hide the cursor. Must be one of the following values: ;Value Meaning ;OATRUE = -1 Hide the cursor. ;OAFALSE = 0 Show the cursor. ;-------IVideoWindow HideCursor Virtual Method Number Is 45;---------------- $Rt = InterfaceCall($IVideoWindow,"long",45,"long",$HideCursor) ;-------IVideoWindow HideCursor Virtual Method Number Is 45;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow) Return SetError(2,0,False) EndIf CtrlGraphRelease($IVideoWindow) Return SetError(0,0,True) EndFunc Func IVideoWindow_SetWindowForeground($IGraphBuilder,$Focus) $IVideoWindow = GetIVideoWindow($IGraphBuilder) if @error Then Return SetError(1,0,False) ;The SetWindowForeground method places the video window at the top of the Z order. ;Focus ;Specifies whether to give the window focus. Must be one of the following values: ;Value Description ;OATRUE = -1 Give the window focus. ;OAFALSE = 0 Do not give the window focus. ;-------IVideoWindow SetWindowForeground Virtual Method Number Is 38;---------------- $Rt = InterfaceCall($IVideoWindow,"long",38,"long",$Focus) ;-------IVideoWindow SetWindowForeground Virtual Method Number Is 38;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow) Return SetError(2,0,False) EndIf CtrlGraphRelease($IVideoWindow) Return SetError(0,0,True) EndFunc Func IVideoWindow_put_BorderColor($IGraphBuilder,$Color) $IVideoWindow = GetIVideoWindow($IGraphBuilder) if @error Then Return SetError(1,0,False) ;-------IVideoWindow put_BorderColor Virtual Method Number Is 35;---------------- $Rt = InterfaceCall($IVideoWindow,"long",35,"long",$Color) ;-------IVideoWindow put_BorderColor Virtual Method Number Is 35;---------------- if @error Or $Rt[0] <> 0 Then CtrlGraphRelease($IVideoWindow) Return SetError(2,0,False) EndIf CtrlGraphRelease($IVideoWindow) Return SetError(0,0,True) EndFunc Func CtrlGraphRelease($IUnknown1 = 0,$IUnknown2 = 0,$IUnknown3 = 0) if ($IUnknown1) Then IUnknownRelease($IUnknown1) if ($IUnknown2) Then IUnknownRelease($IUnknown2) if ($IUnknown3) Then IUnknownRelease($IUnknown3) EndFunc Func Add_Remove_MsgGraphArray($IGraphBuilderObj,$Flag = 1) ;$Flag = 1 Add ;$Flag = 2 Remove Switch $Flag Case 1 if Not IsArray($MsgGraphArray) Then Local $TempMsgGraphArray[1] $TempMsgGraphArray[0] = $IGraphBuilderObj $MsgGraphArray = $TempMsgGraphArray Return SetError(0,0,True) Else For $i = 0 To UBound($MsgGraphArray) - 1 if $IGraphBuilderObj = $MsgGraphArray[$i] Then Return SetError(1,0,False) Next ReDim $MsgGraphArray[UBound($MsgGraphArray) + 1] $MsgGraphArray[UBound($MsgGraphArray) - 1] = $IGraphBuilderObj Return SetError(0,0,True) EndIf Case 2 if IsArray($MsgGraphArray) Then Local $TempMsgGraphArray[UBound($MsgGraphArray)],$Test = False , $j = 0 For $i = 0 To UBound($MsgGraphArray) - 1 if $IGraphBuilderObj = $MsgGraphArray[$i] Then $Test = True ContinueLoop EndIf $TempMsgGraphArray[$j] = $MsgGraphArray[$i] $j += 1 Next if ($Test) Then if UBound($TempMsgGraphArray) > 1 Then ReDim $TempMsgGraphArray[UBound($TempMsgGraphArray) - 1] $MsgGraphArray = $TempMsgGraphArray Else $MsgGraphArray = 0 EndIf Return SetError(0,0,True) Else Return SetError(2,0,False) EndIf EndIf Case Else Return SetError(3,0,False) EndSwitch EndFunc Func IUnknownRelease($IUnknown) ;-------IUnknown Release Virtual Method Number Is 3;---------------- $Rt = InterfaceCall($IUnknown,"long",3) ;-------IUnknown Release Virtual Method Number Is 3;---------------- if @error Then Return SetError(1,0,0) Return SetError(0,0,$Rt[0]) EndFunc Func GetObjFromGuid($StrIID,$StrCLSID) Local $LSCTX_ALL = BitOR(0x1,0x4,0x16),$Rt = 0 if Not ($CoInitialize) Then $Rt = DllCall($Ole32,"long","CoInitialize","ptr",0) if @error Or $Rt[0] <> 0 Then Return SetError(1,0,0) $CoInitialize = True OnAutoItExitRegister("CREATEGRAPH_ON_EXIT") EndIf $clsid = CLSIDFromString($StrCLSID) if @error Then Return SetError(2,0,0) $riid = IIDFromString($StrIID) if @error Then Return SetError(3,0,0) $Rt = DllCall($Ole32,"long","CoCreateInstance","ptr",DllStructGetPtr($clsid), _ "ptr",0,"DWORD",$LSCTX_ALL,"ptr",DllStructGetPtr($riid),"ptr*",0) if @error Or $Rt[0] <> 0 Then Return SetError(4,0,0) Return SetError(0,0,$Rt[5]) EndFunc
    1 point
  5. JScript

    Label inside of a combo box?

    After a brief study and support of members of AutoItBrasil, we come to the following examples: Download: ComboBox_LineSeparator_Beta.zip New updates: ComboBox_LineSeparator_Beta.zip Credits: Anyone wishing to make an improvement, feel free! Regards, João Carlos.
    1 point
  6. No , you don't have to run it with just the beta version, unless you're using a very old version. You can Run the script (F5), or run Au3Check (CTRL-F5), or run it with the Beta version. But it isn't something new, it's been in the language for a while now.
    1 point
  7. Mechaflash

    Im in need of help

    It's like watching the out-of-shape guy go to the gym... and try to pump out 150lbs reps and run 10 miles on the first day. Sir, you're on the road to being sore and quitting if you don't slow it down and start from the beginning.
    1 point
×
×
  • Create New...