获取包含图像解码器信息的数组
#Include <GDIPlus.au3>
_GDIPlus_Decoders()
成功: | 返回下列格式的数组: |
[0][ 0] - 解码器数量 | |
[1][ 1] - 编解码器标识符 | |
[1][ 2] - 文件格式标识符 | |
[1][ 3] - 编解码器名称 | |
[1][ 4] - DLL 文件中的代码驻留 | |
[1][ 5] - 编解码器文件格式名称 | |
[1][ 6] - 编解码器关联文件扩的展名 | |
[1][ 7] - mime 类型的编解码器 | |
[1][ 8] - 与 $GDIP_ICF 的结合标志 | |
[1][ 9] - 编解码器版本 | |
[1][10] - 用于识别标志的文件格式数量 | |
[1][11] - 用于识别标志的字节数 | |
[1][12] - 用于识别标志模式的指针 | |
[1][13] - 用于识别标志掩码的指针 | |
失败: | 设置@error |
在MSDN中搜索
#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WindowsConstants.au3>
Global $iMemo, $aEncoder, $hImage
_Main()
Func _Main()
Local $hBitmap
; 创建 GUI
GUICreate("GDI+", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()
; 初始化 GDI+ 库
_GDIPlus_Startup()
; 创建用于特征列表的图像
$hBitmap = _ScreenCapture_Capture("", 0, 0, 1, 1)
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
; 显示编码器特征
$aEncoder = _GDIPlus_Encoders()
ShowEncoder("Encoder")
; 显示解码器特征
$aEncoder = _GDIPlus_Decoders()
ShowEncoder("Decoder")
; 清理资源
_GDIPlus_ImageDispose($hImage)
_WinAPI_DeleteObject($hBitmap)
; 关闭 GDI+ 库
_GDIPlus_Shutdown()
; 循环直到用户退出
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main
; 写入一行到 memo 控件
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite
; 显示编码器信息
Func ShowEncoder($sTitle)
Local $iI, $iJ, $iK, $sCLSID, $tData, $tParam, $tParams
For $iI = 1 To $aEncoder[0][0]
$sCLSID = _GDIPlus_EncodersGetCLSID($aEncoder[$iI][5])
MemoWrite("Image " & $sTitle & " " & $iI)
MemoWrite(" Codec GUID ............: " & $aEncoder[$iI][1])
MemoWrite(" File format GUID ......: " & $aEncoder[$iI][2])
MemoWrite(" Codec name ............: " & $aEncoder[$iI][3])
MemoWrite(" Codec Dll file name ...: " & $aEncoder[$iI][4])
MemoWrite(" Codec file format .....: " & $aEncoder[$iI][5])
MemoWrite(" File name extensions ..: " & $aEncoder[$iI][6])
MemoWrite(" Mime type .............: " & $aEncoder[$iI][7])
MemoWrite(" Flags .................: 0x" & Hex($aEncoder[$iI][8]))
MemoWrite(" Version ...............: " & $aEncoder[$iI][9])
MemoWrite(" Signature count .......: " & $aEncoder[$iI][10])
MemoWrite(" Signature size ........: " & $aEncoder[$iI][11])
MemoWrite(" Signature pattern ptr .: 0x" & Hex($aEncoder[$iI][12]))
MemoWrite(" Signature mask ptr ....: 0x" & Hex($aEncoder[$iI][13]))
MemoWrite(" Paramater list size ...: " & _GDIPlus_EncodersGetParamListSize($hImage, $sCLSID))
MemoWrite()
$tParams = _GDIPlus_EncodersGetParamList($hImage, $sCLSID)
If @error Then ContinueLoop
For $iJ = 0 To DllStructGetData($tParams, "Count") - 1
MemoWrite(" Image " & $sTitle & " Parameter " & $iJ)
$tParam = DllStructCreate($tagGDIPENCODERPARAM, DllStructGetPtr($tParams, "Params") + ($iJ * 28))
MemoWrite(" Parameter GUID ......: " & _WinAPI_StringFromGUID(DllStructGetPtr($tParam, "GUID")))
MemoWrite(" Number of values ....: " & DllStructGetData($tParam, "Count"))
MemoWrite(" Parameter type.......: " & DllStructGetData($tParam, "Type"))
MemoWrite(" Parameter pointer ...: 0x" & Hex(DllStructGetData($tParam, "Values")))
Switch DllStructGetData($tParam, "Type")
Case 4
$tData = DllStructCreate("int Data[" & DllStructGetData($tParam, "Count") & "]", DllStructGetData($tParam, "Values"))
For $iK = 1 To DllStructGetData($tParam, "Count")
MemoWrite(" Value .............: " & DllStructGetData($tData, 1, $iK))
Next
Case 6
$tData = DllStructCreate("int Low;int High", DllStructGetData($tParam, "Values"))
MemoWrite(" Low range .........: " & DllStructGetData($tData, "Low"))
MemoWrite(" High range ........: " & DllStructGetData($tData, "High"))
EndSwitch
MemoWrite()
Next
Next
EndFunc ;==>ShowEncoder