Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <WindowsConstants.au3>
- #include <GUIConstantsEx.au3>
- #include <GDIPlus.au3>
- #include <WinAPI.au3>
- Opt("guioneventmode",1)
- Global Const $AC_SRC_ALPHA = 1
- _GDIPlus_Startup()
- $hImage = _GDIPlus_ImageLoadFromFile("h.png")
- $width = _GDIPlus_ImageGetWidth($hImage)
- $height = _GDIPlus_ImageGetHeight($hImage)
- $gui = GUICreate("", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED, GUICreate("",0,0,50,100))
- GUICtrlCreateLabel("",0,0,99999,99999,-1,$GUI_WS_EX_PARENTDRAG)
- GUISetOnEvent(-3,"tat")
- GUICtrlCreateButton("daddsa",50,50,220,40)
- GUISetState(@SW_SHOW)
- ShowPic_On_Off(3) ;; thay đổi giá trị này để tăng hoặc giảm số lần hình ảnh xuất hiện và biến mất...
- Sleep(2000)
- Exit
- While 1
- Sleep(100)
- WEnd
- func tat()
- Exit
- 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)
- EndFunc
- Func ShowPic_On_Off($iNumTimes)
- Do
- For $i=255 to 5 Step -10
- SetBitmap($gui, $hImage, $i)
- Sleep(50)
- Next
- For $i=5 to 255 Step +10
- SetBitmap($gui, $hImage, $i)
- Sleep(50)
- Next
- $iNumTimes -= 1
- Until ($iNumTimes == 0)
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement