Obtient le contexte de p�riph�rique (DC) de la zone cliente de la fen�tre sp�cifi�e
#include <WinAPIGdiDC.au3>
_WinAPI_GetWindowDC ( $hWnd )
$hWnd | Handle de la fen�tre |
Succ�s: | Retourne le handle du contexte de p�riph�rique de la zone cliente |
�chec: | Retourne 0 |
GetWindowDC est destin�e � des effets sp�ciaux de peinture dans la zone non cliente d'une fen�tre.
La peinture dans les zones non clientes d'une fen�tre n'est normalement pas recommand�e. La fonction GetSystemMetrics peut �tre utilis�e pour obtenir les dimensions des diff�rentes parties de la zone non cliente, telle que la barre de titre, le menu et les barres de d�filement.
Apr�s que la peinture soit termin�e, la fonction _WinAPI_ReleaseDC() doit �tre appel�e pour lib�rer le contexte de p�riph�rique.
Ne pas lib�rer le contexte de p�riph�rique de la fen�tre a des effets graves sur la peinture demand�e par les applications.
Consultez GetWindowDC dans la librairie MSDN.
#include <WinAPIGdi.au3> #include <WinAPIGdiDC.au3> #include <WinAPIHObj.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> ShowCross(@DesktopWidth / 2, @DesktopHeight / 2, 20, 2, 0xFF, 3000) Func ShowCross($iStart_x, $iStart_y, $iLength, $iWidth, $iColor, $iTime) Local $hDC, $hPen, $o_Orig $hDC = _WinAPI_GetWindowDC(0) ; DC de tout l'�cran (bureau) $hPen = _WinAPI_CreatePen($PS_SOLID, $iWidth, $iColor) $o_Orig = _WinAPI_SelectObject($hDC, $hPen) _WinAPI_DrawLine($hDC, $iStart_x - $iLength, $iStart_y, $iStart_x - 5, $iStart_y) ; gauche horizontal _WinAPI_DrawLine($hDC, $iStart_x + $iLength, $iStart_y, $iStart_x + 5, $iStart_y) ; droite horizontal _WinAPI_DrawLine($hDC, $iStart_x, $iStart_y - $iLength, $iStart_x, $iStart_y - 5) ; Haut vertical ; _WinAPI_DrawLine ($HDC, $iStart_x, $iStart_y + $iLength, $iStart_x, $iStart_y + 5); Bas vertical _WinAPI_MoveTo($hDC, $iStart_x, $iStart_y + $iLength) _WinAPI_LineTo($hDC, $iStart_x, $iStart_y + 5) Sleep($iTime) ; Affiche la croix sur l'�cran pendant quelques secondes ; Rafra�chit le bureau (efface la croix) _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN) ; Nettoie les ressources _WinAPI_SelectObject($hDC, $o_Orig) _WinAPI_DeleteObject($hPen) _WinAPI_ReleaseDC(0, $hDC) EndFunc ;==>ShowCross