#include <GDIPlus.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
Global Const $AC_SRC_ALPHA=1
$x=ObjCreate("WMPlayer.OCX")
#Region ### START Koda GUI section ### Form=
_GDIPlus_Startup()
$hImage=_GDIPlus_ImageLoadFromFile("a1.png")
$width = _GDIPlus_ImageGetWidth($hImage)
$height = _GDIPlus_ImageGetHeight($hImage)
$Form=GUICreate("AU3-调用WMPlayer.OCX来播放MP3文件",$width,$height,200,200,$WS_POPUP,$WS_EX_LAYERED)
SetBitmap($Form,$hImage,240)
$Label1 = GUICtrlCreateLabel("", 32, 110, 19, 48)
$Label2 = GUICtrlCreateLabel("", 32, 166, 19, 48)
$Label3 = GUICtrlCreateLabel("", 32, 222, 19, 55)
$Label4 = GUICtrlCreateLabel("", 550, 110, 19, 48)
$Label5 = GUICtrlCreateLabel("", 550, 166, 19, 48)
$Label6 = GUICtrlCreateLabel("", 550, 222, 19, 55)
GUISetState()
#EndRegion ### START Koda GUI section ### Form=
$Form1=GUICreate("", $width, $height, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $Form)
GUICtrlCreatePic(@ScriptDir & "\grey.gif", 0, 0, $width, $height)
GUICtrlSetState(-1, $GUI_DISABLE)
$x.stretchToFit=GUICtrlCreateObj($x, 85, 60, 418, 270)
GUISetState()
AdlibRegister ("stretchToFit", 500)
$x.uimode="Full"
$x.url="d:\mp3.mp3"
$x.Controls.play
GUIRegisterMsg($WM_NCHITTEST,"WM_NCHITTEST")
While 1
_ReduceMemory(@AutoItPID)
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Label1
Msgbox(0,0,'$Label1')
Case $Label2
Msgbox(0,0,'$Label2')
Case $Label3
Msgbox(0,0,'$Label3')
Case $Label4
Msgbox(0,0,'$Label4')
Case $Label5
Msgbox(0,0,'$Label5')
Case $Label6
Msgbox(0,0,'$Label6')
EndSwitch
WEnd
Func _ReduceMemory($i_PID = -1)
If $i_PID <> -1 Then
Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
Else
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
EndIf
Return $ai_Return[0]
EndFunc
Func stretchToFit()
$x.stretchToFit=GUICtrlCreateObj($x, 85, 60, 418, 270);非全屏状态时是否伸展到最佳大小
EndFunc
Func WM_NCHITTEST($hwnd,$iMsg,$hPamare,$lPamare)
if($hwnd=$Form) And ($iMsg=$WM_NCHITTEST) Then Return $HTCAPTION
EndFunc
Func SetBitmap($hGUI, $hImage, $iOpacity)
Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
$hScrDC= _WinAPI_GetDC(0)
$hMemDC= _WinAPI_CreateCompatibleDC($hScrDC)
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
$hOld= _WinAPI_SelectObject($hMemDC, $hBitmap)
$tSize = DllStructCreate($tagSIZE)
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth ($hImage))
DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend= DllStructCreate($tagBLENDFUNCTION)
$pBlend= DllStructGetPtr($tBlend)
DllStructSetData($tBlend, "Alpha" , $iOpacity)
DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)
_WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
_WinAPI_ReleaseDC (0, $hScrDC)
_WinAPI_SelectObject($hMemDC, $hOld)
_WinAPI_DeleteObject($hBitmap)
_WinAPI_DeleteDC($hMemDC)
_GDIPlus_ShutDown ()
EndFunc