Affiche l'image stock�e dans un m�tafichier au format �tendu sp�cifi�
#include <WinAPIGdi.au3>
_WinAPI_PlayEnhMetaFile ( $hDC, $hEmf, $tRECT )
$hDC | Handle du contexte de p�riph�rique pour le p�riph�rique de sortie sur lequel l'image appara�tra. |
$hEmf | Handle du m�tafichier �tendu. |
$tRECT | Structure $tagRECT qui contient les coordonn�es du rectangle englobant utilis� pour afficher l'image, en unit�s logiques |
Succ�s: | Retourne True |
�chec: | Retourne False |
Un m�tafichier �tendu peut �tre int�gr� dans un m�tafichier �tendu nouvellement cr�� en appelant _WinAPI_PlayEnhMetaFile() et en jouant le m�tafichier �tendu source dans le contexte de p�riph�rique pour le nouveau m�tafichier �tendu.
Consultez PlayEnhMetaFile dans la librairie MSDN.
#include <GUIConstantsEx.au3> #include <SendMessage.au3> #include <StaticConstants.au3> #include <WinAPIGdi.au3> #include <WinAPIGdiDC.au3> #include <WinAPIHObj.au3> #include <WinAPIMisc.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> ; Charge un m�tafichier �tendu (.emf) et r�cup�re sa dimension (x6) Local $hEmf = _WinAPI_GetEnhMetaFile(@ScriptDir & '\Extras\Flag.emf') Local $tSIZE = _WinAPI_GetEnhMetaFileDimension($hEmf) Local $iWidth = 6 * DllStructGetData($tSIZE, 'X') Local $iHeight = 6 * DllStructGetData($tSIZE, 'Y') ; Cr�e une GUI Local $hForm = GUICreate('Test '& StringReplace(@ScriptName, '.au3', '()'), $iWidth, $iHeight) Local $idPic = GUICtrlCreatePic('', 0, 0, $iWidth, $iHeight) Local $hPic = GUICtrlGetHandle($idPic) ; Cr�e un bitmap � partir du m�tafichier �tendu Local $hDC = _WinAPI_GetDC($hPic) Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC) Local $hBitmap = _WinAPI_CreateCompatibleBitmapEx($hDC, $iWidth, $iHeight, _WinAPI_SwitchColor(_WinAPI_GetSysColor($COLOR_3DFACE))) Local $hMemSv = _WinAPI_SelectObject($hMemDC, $hBitmap) Local $tRECT = _WinAPI_CreateRectEx(0, 0, $iWidth, $iHeight) _WinAPI_PlayEnhMetaFile($hMemDC, $hEmf, $tRECT) _WinAPI_ReleaseDC($hPic, $hDC) _WinAPI_SelectObject($hMemDC, $hMemSv) _WinAPI_DeleteDC($hMemDC) ; Lib�re le m�tafichier �tendu _WinAPI_DeleteEnhMetaFile($hEmf) ; D�finit le bitmap dans le contr�le Picture _SendMessage($hPic, $STM_SETIMAGE, 0, $hBitmap) Local $hObj = _SendMessage($hPic, $STM_GETIMAGE) If $hObj <> $hBitmap Then _WinAPI_DeleteObject($hBitmap) EndIf GUISetState(@SW_SHOW) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE