Code tạo khung thông báo cho Flash tặng ng iu

Trang ChínhLatest imagesTìm kiếmĐăng kýĐăng Nhập


Welcome to Forums Haku
Chào mừng các bạn đến với diễn đàn
Chúc các bạn có những giờ phút thư giãn thoải mái tại diễn đàn
Chúc các bạn luôn thành công trong cuộc sống

<--Code by Admin Haku -->

Share|
Tiêu đề

Code tạo khung thông báo cho Flash tặng ng iu

Xem chủ đề cũ hơn Xem chủ đề mới hơn Go down
Tác giảThông điệp

Admin
Member
Admin

Tổng bài gửi : 1074
Được Cảm Ơn : 538
Đến từ : Hà Ná»™i
Tài năng của Admin
Hạng: Member
Level:1074
Tài năng:/300


Tài Sản
Huân Chương: PhotobucketPhotobucketPhotobucketPhotobucketPhotobucketPhotobucketPhotobucketPhotobucketPhotobucket

Bài gửiTiêu đề: Code tạo khung thông báo cho Flash tặng ng iu Code tạo khung thông báo cho Flash tặng ng iu 3e45c23a204Sun Sep 16, 2012 4:46 pm

Code tạo khung thông báo cho Flash tặng ng iu

Demo:

Code tạo khung thông báo cho Flash tặng ng iu Demo1

Code tạo khung thông báo cho Flash tặng ng iu Demo2



Dowload:  Click here


Haku
Code:
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Version=beta
#AutoIt3Wrapper_Icon=..\..\123.ico
#AutoIt3Wrapper_Outfile=Häkü0.exe
#AutoIt3Wrapper_Outfile_x64=Häkü0.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Fileversion=0.0.0.4
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
$auto1 = "co"
$bLoop = 1
While $bLoop = 1
$text = InputBox("Điền [co] em nhé", " Anh Häkü có 1 món quà muốn tặng bạn!    Bạn có muốn nhận món quà này không?")
If @error = 1 Then
MsgBox(4096, "Smileee", "Bạn không thể ấn để thoát được đâu")
Else
If $text <> $auto1 Then
MsgBox(4096, "Ngu lắm", "Ban đã nhập sai - làm lai đi!")
Else
$bLoop = 0
EndIf
EndIf
WEnd
MsgBox(4096,"Haku.4rumer.com", "Okey! bạn khôn lắm.")


    $main = GUICreate ("Haku.4rumer.com", 350, 150)
    $input = GUICtrlCreateInput ("", 5, 7, 300, 25)
    $label = GUICtrlCreateLabel ("", 5, 25, 300, 25)
    $label2 = GUICtrlCreateLabel ('Trước khi nhận món quà này! Anh muốn em làm 1 điều, chỉ 1 điều thôi =.='&@CRLF&'Em hãy điền vào ô kia chữ "Em Yêu Anh Haku" là được. Anh sẽ cho 1 con virus theo dõi xem em điền có đúng không, nên em đừng nghĩ cách qua mặt nó nhé ^^! Nhớ viết có dấu em nhé.', 5, 50, 300, 100)
    GUISetState (@SW_SHOW)
    While GUICtrlRead ($label) <> "Em Yêu Anh Haku"
        Sleep (1000)
        GUICtrlSetData (($label), GUICtrlRead($input))
    WEnd
    GUIDelete ($main)
    Sleep (1000)
    MsgBox (0,"Haku.4rumer.com", "Tốt lắm, Nói lời yêu anh rồi")
   MsgBox (0,"Haku.4rumer.com", "Thì phải giữ lấy lời em nhé ^^!")
   MsgBox (0,"Haku.4rumer.com", "Em mà không giữ lời")
   MsgBox (0,"Haku.4rumer.com", "Là anh sẽ cho con virus này phá máy của em đó")
;Khai báo thư viện
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <GIFAnimation.au3>
#include <Misc.au3>
;Khuyến khích
MsgBox(0,'I Love U','Em hãy bật loa hoặc tai nghe lên nhé ^^!')
;Khai báo mảng và thông tin
Global $install[10]
$install[0]= 'data/Suy nghi trong anh.mp3'
$install[1]= 'data/Tuan Hung - Tim Lai Bau Troi.mp3'
$install[2]= 'data/loveforyou.exe'
$install[3]= 'data/I Love U 1.gif'
$install[4]= 'data/I Love U 2.gif'
$install[5]= 'data/I Love U 3.gif'
$install[6]= 'data/Love.gif'
$install[7]= 'data/Heo 1.gif'
$install[8]= 'data/Heo 2.gif'
$install[9]= 'data/heart.jpg'
$w= @DesktopWidth/1024
$h= @DesktopHeight/768
$all= $w * $h
$title= 'I Love U'
;Cập nhật dữ liệu
ProgressOn('','Chương trình đang cập nhật dữ liệu.Vui lòng đợi trong giây lát!','')
DirCreate('data')
Sleep(100)
FileInstall('data/Suy nghi trong anh.mp3','data/Suy nghi trong anh.mp3')
ProgressSet(10)
FileInstall('data/Tuan Hung - Tim Lai Bau Troi.mp3','data/Tuan Hung - Tim Lai Bau Troi.mp3')
ProgressSet(20)
FileInstall('data/loveforyou.exe','data/loveforyou.exe')
ProgressSet(30)
FileInstall('data/I Love U 1.gif','data/I Love U 1.gif')
ProgressSet(40)
FileInstall('data/I Love U 2.gif','data/I Love U 2.gif')
ProgressSet(50)
FileInstall('data/I Love U 3.gif','data/I Love U 3.gif')

ProgressSet(60)
FileInstall('data/Love.gif','data/Love.gif')
ProgressSet(70)
FileInstall('data/Heo 1.gif','data/Heo 1.gif')
ProgressSet(80)
FileInstall('data/Heo 2.gif','data/Heo 2.gif')
ProgressSet(90)
FileInstall('data/heart.jpg','data/heart.jpg')
ProgressSet(100)
Sleep(100)
ProgressOff()
Sleep(1000)
;Hàm giảm âm lượng
      For $k= 100 To 0 Step -0
         SoundSetWaveVolume($k)
         Sleep(50)
         Next
      Run($install[2])
      Sleep(30000)
      BlockInput(0)
      MouseClick('left')
      For $a= 255 To 0 Step -0
         WinSetTrans($title,'',$a)
         Sleep(1)
      Next
      Exit









GIFAnimation

Code:
#include-once


; #FUNCTION# ;===============================================================================
;
; Name...........: _GUICtrlCreateGIF
; Description ...: Creates GIF control for the GUI
; Syntax.........: _GUICtrlCreateGIF($sFileName, $iLeft, $iTop, ByRef $aGIFArrayOfIconHandles, ByRef $hGIFThread, ByRef $iTransparency, ByRef $pCurrentFrame)
; Parameters ....: $sFileName - full path to the GIF file
;                  $iLeft - left side of the control
;                  $iTop - the top of the control
;                  $aGIFArrayOfIconHandles - variable that receives handles of the icons generated from GIF. Will be an array.
;                  $hGIFThread - variable that receives handle to the thread in which GIF is animated
;                  $iTransparency -  variable that receives transparency value (1 - transparent, 0 - not transparent)
;                  $pCurrentFrame - variable that receives structure (dword) that holds current number of frame. First frame is 0.
; Return values .: Success - Returns controlID of the new control
;                          - Sets @error to 0
;                  Failure - Returns 0 sets @error:
;                  |1 - GDI+ related error
;                  |2 - Animation failed
; Author ........: trancexx
;
;==========================================================================================
Func _GUICtrlCreateGIF($sFileName, $iLeft, $iTop, ByRef $aGIFArrayOfIconHandles, ByRef $hGIFThread, ByRef $iTransparency, ByRef $tCurrentFrame)

   Local $hGIF = GUICtrlCreateIcon("", "", 0, 0)

   $aGIFArrayOfIconHandles = _CreateArrayHIconsFromGIFFile($hGIF, $sFileName, $iLeft, $iTop, $iTransparency)

   If @error Then
      GUICtrlDelete($hGIF)
      $hGIF = 0
      Return SetError(1, 0, 0)
   EndIf

   If UBound($aGIFArrayOfIconHandles) > 1 Then ; if GIF is animated one

      $hGIFThread = _AnimateGifInAnotherThread($hGIF, $aGIFArrayOfIconHandles, $iTransparency, $tCurrentFrame)

      If @error Then
         For $i = 0 To UBound($aGIFArrayOfIconHandles) - 1
            DllCall("user32.dll", "int", "DestroyIcon", "hwnd", $aGIFArrayOfIconHandles[$i][0])
         Next
         Return SetError(2, 0, 0)
      EndIf

   EndIf

   Return SetError(0, 0, $hGIF)

EndFunc  ;==>_GUICtrlCreateGIF


; #FUNCTION# ;===============================================================================
;
; Name...........: _GUICtrlDeleteGIF
; Description ...: Deletes GIF control
; Syntax.........: _GUICtrlDeleteGIF(ByRef $hGIF, ByRef $aGIFArrayOfIconHandles, ByRef $hGIFThread, ByRef $tCurrentFrame)
; Parameters ....: $hGIF - GIF controlID
;                  $aGIFArrayOfIconHandles - array of icon handles returned by _GUICtrlCreateGIF() function
;                  $hGIFThread - handle to the thread in which GIF is animated (returned by _GUICtrlCreateGIF() function)
;                  $tCurrentFrame - structure that holds current number of frame (returned by _GUICtrlCreateGIF() function)
; Return values .: Returns 1 regardless of success
; Author ........: trancexx
;
;==========================================================================================
Func _GUICtrlDeleteGIF(ByRef $hGIF, ByRef $aGIFArrayOfIconHandles, ByRef $hGIFThread, ByRef $tCurrentFrame)

   _ExitGIFAnimation($aGIFArrayOfIconHandles, $hGIFThread, 1)
   GUICtrlDelete($hGIF)
   $hGIF = 0
   $tCurrentFrame = 0

   Return 1

EndFunc  ;==>_GUICtrlDeleteGIF


; #FUNCTION# ;===============================================================================
;
; Name...........: _StopGIFAnimation
; Description ...: Stops animation of GIF control
; Syntax.........: _StopGIFAnimation($hGIFThread)
; Parameters ....: $hGIFThread - handle to the thread in which GIF is animated (returned by _GUICtrlCreateGIF() function)
; Return values .: Success - Returns 1
;                          - Sets @error to 0
;                  Failure - Returns 0 sets @error:
;                  |1 - SuspendThread function or call to it failed
; Author ........: trancexx
;
;==========================================================================================
Func _StopGIFAnimation($hGIFThread)

   If $hGIFThread Then

      Local $a_iCall = DllCall("kernel32.dll", "dword", "SuspendThread", "ptr", $hGIFThread)

      If @error Or $a_iCall[0] = -1 Then
         Return SetError(1, 0, 0)
      EndIf

      If $a_iCall[0] Then
         DllCall("kernel32.dll", "dword", "ResumeThread", "ptr", $hGIFThread)
      EndIf

      Return 1

   EndIf

EndFunc  ;==>_StopGIFAnimation


; #FUNCTION# ;===============================================================================
;
; Name...........: _ResumeGIFAnimation
; Description ...: Resumes stopped animation of GIF control
; Syntax.........: _ResumeGIFAnimation($hGIFThread)
; Parameters ....: $hGIFThread - handle to the thread in which GIF is animated (returned by _GUICtrlCreateGIF() function)
; Return values .: Success - Returns 1
;                          - Sets @error to 0
;                  Failure - Returns 0 sets @error:
;                  |1 - ResumeThread function or call to it failed
; Author ........: trancexx
;
;==========================================================================================
Func _ResumeGIFAnimation($hGIFThread)

   If $hGIFThread Then

      Local $a_iCall = DllCall("kernel32.dll", "dword", "ResumeThread", "ptr", $hGIFThread)

      If @error Or $a_iCall[0] = -1 Then
         Return SetError(1, 0, 0)
      EndIf

      If $a_iCall[0] = 2 Then
         DllCall("kernel32.dll", "dword", "SuspendThread", "ptr", $hGIFThread)
      EndIf

      Return 1

   EndIf

EndFunc  ;==>_ResumeGIFAnimation


; #FUNCTION# ;===============================================================================
;
; Name...........: _ExitGIFAnimation
; Description ...: Exits animation of GIF control
; Syntax.........: _ExitGIFAnimation(ByRef $aGIFArrayOfIconHandles, ByRef $hGIFThread [, iTotal])
; Parameters ....: $aGIFArrayOfIconHandles - array of icon handles returned by _GUICtrlCreateGIF() function
;                  $hGIFThread - handle to the thread in which GIF is animated (returned by _GUICtrlCreateGIF() function)
;                  iTotal - optional parameter to set behaviour of function. Can be:
;                                                                                0 - Default - Destroy all icon handles but first
;                                                                                1 - Destroy all icon handles
; Return values .: Returns 1
;                  Sets @error to 0
; Author ........: trancexx
;
;==========================================================================================
Func _ExitGIFAnimation(ByRef $aGIFArrayOfIconHandles, ByRef $hGIFThread, $iTotal = 0)

   If $hGIFThread Then
      DllCall("kernel32.dll", "ptr", "TerminateThread", "ptr", $hGIFThread, "dword", 0)
      $hGIFThread = 0
   EndIf

   If IsArray($aGIFArrayOfIconHandles) Then
      If $iTotal Then
         For $i = 0 To UBound($aGIFArrayOfIconHandles) - 1
            DllCall("user32.dll", "int", "DestroyIcon", "hwnd", $aGIFArrayOfIconHandles[$i][0]) ; destroy icons
         Next
         $aGIFArrayOfIconHandles = 0
      Else
         For $i = 1 To UBound($aGIFArrayOfIconHandles) - 1 ; all but the first frame
            DllCall("user32.dll", "int", "DestroyIcon", "hwnd", $aGIFArrayOfIconHandles[$i][0]) ; destroy icons
         Next
         ReDim $aGIFArrayOfIconHandles[1][3]
      EndIf
   EndIf

   Return 1

EndFunc  ;==>_ExitGIFAnimation


; #FUNCTION# ;===============================================================================
;
; Name...........: _RefreshGIF
; Description ...: Refreshes GIF control
; Syntax.........: _RefreshGIF($hGIFControl, $aGIFArrayOfIconHandles, $hGIFThread, $iGIFTransparent, $tFrameCurrent)
; Parameters ....: $hGIFControl - GIF control ID returned by _GUICtrlCreateGIF() function
;                  $aGIFArrayOfIconHandles - array of icon handles returned by _GUICtrlCreateGIF() function
;                  $hGIFThread - thread in which GIF is animated, returned by _GUICtrlCreateGIF() function
;                  $iGIFTransparent - transparency value returned by _GUICtrlCreateGIF() function
;                  $tFrameCurrent - structure that holds current number of frame, returned by _GUICtrlCreateGIF() function
; Return values .: Success - Refreshes GIF control
;                  Failure - Nothing
; Author ........: trancexx
;
;==========================================================================================
Func _RefreshGIF($hGIFControl, $aGIFArrayOfIconHandles, $hGIFThread, $iGIFTransparent, $tFrameCurrent)

   If $hGIFThread Then
      If Not $iGIFTransparent And IsArray($aGIFArrayOfIconHandles) Then

         Local $hControl = GUICtrlGetHandle($hGIFControl)

         Local $aCall = DllCall("user32.dll", "hwnd", "GetDC", "hwnd", $hControl)
         If @error Then
            Return
         EndIf
         Local $hDC = $aCall[0]

         Local $iFrameCurrent = DllStructGetData($tFrameCurrent, 1)
         If $iFrameCurrent > UBound($aGIFArrayOfIconHandles) - 1 Then
            $iFrameCurrent = 0
         EndIf

         Local $hIcon = $aGIFArrayOfIconHandles[$iFrameCurrent][0]

         DllCall("User32.dll", "int", "DrawIconEx", _
               "hwnd", $hDC, _
               "int", 0, _
               "int", 0, _
               "hwnd", $hIcon, _
               "int", 0, _
               "int", 0, _
               "dword", 0, _
               "hwnd", 0, _
               "dword", 3) ; DI_NORMAL

         DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hControl, "hwnd", $hDC)

      EndIf
   EndIf

EndFunc  ;==>_RefreshGIF


; #FUNCTION# ;===============================================================================
;
; Name...........: _GIFGetDimension
; Description ...: Returns array of GIF image dimension
; Syntax.........: _GIFGetDimension($sFile)
; Parameters ....: $sFile - full path to the GIF file
; Return values .: Success - Returns array which first element [0] is width,
;                                        second element [1] is height,
;                          - Sets @error to 0
;                  Failure - Returns array which first element [0] 0 (zero),
;                                        second element [1] 0 (zero),
;                          - Sets @error:
;                          |1, 2 - unable to use gdiplus.dll
;                          |3 - GdiplusStartup or call to it failed
;                          |4 - GdipLoadImageFromFile or call to it failed
;                          |5 - GdipGetImageDimension or call to it failed
; Author ........: trancexx
;
;==========================================================================================
Func _GIFGetDimension($sFile)

   Local $aOut[2] = [0, 0]

   Local $a_hCall = DllCall("kernel32.dll", "hwnd", "GetModuleHandleW", "wstr", "gdiplus.dll")

   If @error Then
      Return SetError(1, 0, $aOut)
   EndIf

   If Not $a_hCall[0] Then
      Local $hDll = DllOpen("gdiplus.dll")
      If @error Or $hDll = -1 Then
         Return SetError(2, 0, $aOut)
      EndIf
   EndIf

   Local $tGdiplusStartupInput = DllStructCreate("dword GdiplusVersion;" & _
         "ptr DebugEventCallback;" & _
         "int SuppressBackgroundThread;" & _
         "int SuppressExternalCodecs")

   DllStructSetData($tGdiplusStartupInput, "GdiplusVersion", 1)

   Local $a_iCall = DllCall("gdiplus.dll", "dword", "GdiplusStartup", _
         "dword*", 0, _
         "ptr", DllStructGetPtr($tGdiplusStartupInput), _
         "ptr", 0)

   If @error Or $a_iCall[0] Then
      Return SetError(3, 0, $aOut)
   EndIf

   Local $hGDIplus = $a_iCall[1]

   $a_iCall = DllCall("gdiplus.dll", "dword", "GdipLoadImageFromFile", _
         "wstr", $sFile, _
         "ptr*", 0)

   If @error Or $a_iCall[0] Then
      DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)
      Return SetError(4, 0, $aOut)
   EndIf

   Local $pBitmap = $a_iCall[2]

   $a_iCall = DllCall("gdiplus.dll", "dword", "GdipGetImageDimension", _
         "ptr", $pBitmap, _
         "float*", 0, _
         "float*", 0)

   If @error Or $a_iCall[0] Then
      DllCall("gdiplus.dll", "dword", "GdipDisposeImage", "ptr", $pBitmap)
      DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)
      Return SetError(5, 0, $aOut)
   EndIf

   $aOut[0] = $a_iCall[2]
   $aOut[1] = $a_iCall[3]

   DllCall("gdiplus.dll", "dword", "GdipDisposeImage", "ptr", $pBitmap)
   DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)

   Return SetError(0, 0, $aOut)

EndFunc  ;==>_GIFGetDimension


; #FUNCTION# ;===============================================================================
;
; Name...........: _AnimateGifInAnotherThread
; Description ...: Animates GIF control
; Syntax.........: _AnimateGifInAnotherThread($hGIFControl, $aArrayOfHandlesAndTimes, $iTransparent, $pCurrentFrame)
; Remarks .......: This function if for internal useage by this script
; Author ........: trancexx
;
;==========================================================================================
Func _AnimateGifInAnotherThread($hGIFControl, $aArrayOfHandlesAndTimes, $iTransparent, ByRef $tCurrentFrame)

   Local $aCall = DllCall("kernel32.dll", "ptr", "GetModuleHandleW", "wstr", "kernel32.dll")
   If @error Or Not $aCall[0] Then
      Return SetError(1, 0, "")
   EndIf

   Local $hHandle = $aCall[0]

   Local $aSleep = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", $hHandle, "str", "Sleep")
   If @error Or Not $aSleep[0] Then
      Return SetError(2, 0, "")
   EndIf

   Local $pSleep = $aSleep[0]

   Local $iUbound = UBound($aArrayOfHandlesAndTimes)

   $tCurrentFrame = DllStructCreate("dword")
   Local $pCurrentFrame = DllStructGetPtr($tCurrentFrame)

   Local $tagCodeBuffer
   Local $tCodeBuffer
   Local $pRemoteCode

   If $iTransparent Then

      $aCall = DllCall("kernel32.dll", "ptr", "GetModuleHandleW", "wstr", "user32.dll")
      If @error Or Not $aCall[0] Then
         Return SetError(3, 0, "")
      EndIf

      $hHandle = $aCall[0]

      Local $aSendMessageW = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", $hHandle, "str", "SendMessageW")
      If @error Or Not $aSendMessageW[0] Then
         Return SetError(4, 0, "")
      EndIf

      Local $pSendMessageW = $aSendMessageW[0]

      For $i = 1 To $iUbound
         $tagCodeBuffer &= "byte[39];"
      Next
      $tagCodeBuffer &= "byte[6]"

      $tCodeBuffer = DllStructCreate($tagCodeBuffer)

      $pRemoteCode = DllCall("kernel32.dll", "ptr", "VirtualAlloc", _
            "ptr", 0, _
            "dword", DllStructGetSize($tCodeBuffer), _
            "dword", 4096, _ ; MEM_COMMIT
            "dword", 64) ; PAGE_EXECUTE_READWRITE

      $pRemoteCode = $pRemoteCode[0]

      For $i = 1 To $iUbound

         DllStructSetData($tCodeBuffer, $i, _
               "0x" & _
               "68" & SwapEndian(0) & _                                  ; push lParam
               "68" & SwapEndian($aArrayOfHandlesAndTimes[$i - 1][0]) & _ ; push handle to the icon
               "68" & SwapEndian(368) & _                                ; push STM_SETICON
               "68" & SwapEndian(GUICtrlGetHandle($hGIFControl)) & _      ; push HANDLE
               "B8" & SwapEndian($pSendMessageW) & _                      ; mov eax, SendMessageW
               "FFD0" & _                                                ; call eax
               "68" & SwapEndian($aArrayOfHandlesAndTimes[$i - 1][1]) & _ ; push Milliseconds
               "B8" & SwapEndian($pSleep) & _                            ; mov eax, Sleep
               "FFD0" _                                                  ; call eax
               )

      Next

      DllStructSetData($tCodeBuffer, $iUbound + 1, _
            "0x" & _
            "E9" & SwapEndian(-($iUbound * 39 + 5)) & _                    ; jump [start address]
            "C3" _                                                        ; ret
            )

   Else

      $aCall = DllCall("kernel32.dll", "ptr", "GetModuleHandleW", "wstr", "user32.dll")
      If @error Or Not $aCall[0] Then
         Return SetError(3, 0, "")
      EndIf

      $hHandle = $aCall[0]

      Local $aDrawIconEx = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", $hHandle, "str", "DrawIconEx")
      If @error Or Not $aDrawIconEx[0] Then
         Return SetError(5, 0, "")
      EndIf

      Local $pDrawIconEx = $aDrawIconEx[0]

      For $i = 1 To $iUbound
         $tagCodeBuffer &= "byte[74];"
      Next
      $tagCodeBuffer &= "byte[6]"

      $tCodeBuffer = DllStructCreate($tagCodeBuffer)

      $pRemoteCode = DllCall("kernel32.dll", "ptr", "VirtualAlloc", _
            "ptr", 0, _
            "dword", DllStructGetSize($tCodeBuffer), _
            "dword", 4096, _ ; MEM_COMMIT
            "dword", 64) ; PAGE_EXECUTE_READWRITE

      $pRemoteCode = $pRemoteCode[0]

      $aCall = DllCall("user32.dll", "hwnd", "GetDC", "hwnd", GUICtrlGetHandle($hGIFControl))
      If @error Or Not $aCall[0] Then
         Return SetError(6, 0, "")
      EndIf

      Local $hDC = $aCall[0]

      For $i = 1 To $iUbound

         DllStructSetData($tCodeBuffer, $i, _
               "0x" & _
               "68" & SwapEndian(3) & _                                  ; push Flags DI_NORMAL
               "68" & SwapEndian(0) & _                                  ; push FlickerFreeDraw
               "68" & SwapEndian(0) & _                                  ; push IfAniCur
               "68" & SwapEndian(0) & _                                  ; push Height
               "68" & SwapEndian(0) & _                                  ; push Width
               "68" & SwapEndian($aArrayOfHandlesAndTimes[$i - 1][0]) & _ ; push handle to the icon
               "68" & SwapEndian(0) & _                                  ; push Top
               "68" & SwapEndian(0) & _                                  ; push Left
               "68" & SwapEndian($hDC) & _                                ; push DC
               "B8" & SwapEndian($pDrawIconEx) & _                        ; mov eax, DrawIconEx
               "FFD0" & _                                                ; call eax
               "B8" & SwapEndian($i - 1) & _                              ; mov eax, $i-1
               "A3" & SwapEndian($pCurrentFrame) & _                      ; mov $pCurrentFrame, eax
               "68" & SwapEndian($aArrayOfHandlesAndTimes[$i - 1][1]) & _ ; push Milliseconds
               "B8" & SwapEndian($pSleep) & _                            ; mov eax, Sleep
               "FFD0" _                                                  ; call eax
               )

      Next

      DllStructSetData($tCodeBuffer, $iUbound + 1, _
            "0x" & _
            "E9" & SwapEndian(-($iUbound * 74 + 5)) & _                    ; jump [start address]
            "C3" _                                                        ; ret
            )

   EndIf

   DllCall("kernel32.dll", "none", "RtlMoveMemory", _
         "ptr", $pRemoteCode, _
         "ptr", DllStructGetPtr($tCodeBuffer), _
         "dword", DllStructGetSize($tCodeBuffer))

   $aCall = DllCall("kernel32.dll", "ptr", "CreateThread", "ptr", 0, "dword", 0, "ptr", $pRemoteCode, "ptr", 0, "dword", 0, "dword*", 0)

   If @error Or Not $aCall[0] Then
      Return SetError(7, 0, "")
   EndIf

   Local $hGIFThread = $aCall[0]

   Return SetError(0, 0, $hGIFThread) ; this is success

EndFunc  ;==>_AnimateGifInAnotherThread


; #FUNCTION# ;===============================================================================
;
; Name...........: SwapEndian
; Description ...: 4 byte endian swapper
; Syntax.........: SwapEndian($iValue)
; Remarks .......: This function if for internal useage by this script
; Author ........: trancexx
;
;==========================================================================================
Func SwapEndian($iValue)

   Return Hex(BinaryMid($iValue, 1, 4))

EndFunc  ;==>SwapEndian


; #FUNCTION# ;===============================================================================
;
; Name...........: _CreateArrayHIconsFromGIFFile
; Description ...: Create array of icon handles out of GIF file
; Syntax.........: _CreateArrayHIconsFromGIFFile($sFile, ByRef $iWidth, ByRef $iHeight, ByRef $iTransparency)
; Remarks .......: This function if for internal useage by this script
; Author ........: trancexx (GDI+ part originally by ProgAndy)
;
;==========================================================================================
Func _CreateArrayHIconsFromGIFFile($hGIF, $sFile, $iLeft, $iTop, ByRef $iTransparency)

   Local $a_hCall = DllCall("kernel32.dll", "hwnd", "GetModuleHandleW", "wstr", "gdiplus.dll")

   If @error Then
      Return SetError(1, 0, "")
   EndIf

   If Not $a_hCall[0] Then
      Local $hDll = DllOpen("gdiplus.dll")
      If @error Or $hDll = -1 Then
         Return SetError(2, 0, "")
      EndIf
   EndIf

   Local $tGdiplusStartupInput = DllStructCreate("dword GdiplusVersion;" & _
         "ptr DebugEventCallback;" & _
         "int SuppressBackgroundThread;" & _
         "int SuppressExternalCodecs")

   DllStructSetData($tGdiplusStartupInput, "GdiplusVersion", 1)

   Local $a_iCall = DllCall("gdiplus.dll", "dword", "GdiplusStartup", _
         "dword*", 0, _
         "ptr", DllStructGetPtr($tGdiplusStartupInput), _
         "ptr", 0)

   If @error Or $a_iCall[0] Then
      Return SetError(3, 0, "")
   EndIf

   Local $hGDIplus = $a_iCall[1]

   $a_iCall = DllCall("gdiplus.dll", "dword", "GdipLoadImageFromFile", _
         "wstr", $sFile, _
         "ptr*", 0)

   If @error Or $a_iCall[0] Then
      DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)
      Return SetError(4, 0, "")
   EndIf

   Local $pBitmap = $a_iCall[2]

   $a_iCall = DllCall("gdiplus.dll", "dword", "GdipGetImageDimension", _
         "ptr", $pBitmap, _
         "float*", 0, _
         "float*", 0)

   If @error Or $a_iCall[0] Then
      DllCall("gdiplus.dll", "dword", "GdipDisposeImage", "ptr", $pBitmap)
      DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)
      Return SetError(5, 0, "")
   EndIf

   Local $iWidth = $a_iCall[2]
   Local $iHeight = $a_iCall[3]

   GUICtrlSetPos($hGIF, $iLeft, $iTop, $iWidth, $iHeight)

   $a_iCall = DllCall("gdiplus.dll", "dword", "GdipImageGetFrameDimensionsCount", _
         "ptr", $pBitmap, _
         "dword*", 0)

   If @error Or $a_iCall[0] Then
      DllCall("gdiplus.dll", "dword", "GdipDisposeImage", "ptr", $pBitmap)
      DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)
      Return SetError(6, 0, "")
   EndIf

   Local $iFrameDimensionsCount = $a_iCall[2]

   Local $tGUID = DllStructCreate("int;short;short;byte[8]")

   $a_iCall = DllCall("gdiplus.dll", "dword", "GdipImageGetFrameDimensionsList", _
         "ptr", $pBitmap, _
         "ptr", DllStructGetPtr($tGUID), _
         "dword", $iFrameDimensionsCount)

   If @error Or $a_iCall[0] Then
      DllCall("gdiplus.dll", "dword", "GdipDisposeImage", "ptr", $pBitmap)
      DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)
      Return SetError(7, 0, "")
   EndIf

   $a_iCall = DllCall("gdiplus.dll", "dword", "GdipImageGetFrameCount", _
         "ptr", $pBitmap, _
         "ptr", DllStructGetPtr($tGUID), _
         "dword*", 0)

   If @error Or $a_iCall[0] Then
      DllCall("gdiplus.dll", "dword", "GdipDisposeImage", "ptr", $pBitmap)
      DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)
      Return SetError(8, 0, "")
   EndIf

   Local $iFrameCount = $a_iCall[3]

   Local $aHBitmaps[$iFrameCount][3]

   Local $x = 1

   For $i = 0 To $iFrameCount - 1

      $a_iCall = DllCall("gdiplus.dll", "dword", "GdipImageSelectActiveFrame", _
            "ptr", $pBitmap, _
            "ptr", DllStructGetPtr($tGUID), _
            "dword", $i)

      If @error Or $a_iCall[0] Then
         $aHBitmaps[$i][0] = 0
         ContinueLoop
      EndIf

      $a_iCall = DllCall("gdiplus.dll", "dword", "GdipCreateHICONFromBitmap", _
            "ptr", $pBitmap, _
            "hwnd*", 0)

      If @error Or $a_iCall[0] Then
         $aHBitmaps[$i][0] = 0
         ContinueLoop
      EndIf

      $aHBitmaps[$i][0] = $a_iCall[2]

      If $x Then ; first valid frame gets drawn
         GUICtrlSendMsg($hGIF, 368, $aHBitmaps[$i][0], 0) ;STM_SETICON
         $x = 0
      EndIf

   Next

   $a_iCall = DllCall("gdiplus.dll", "dword", "GdipGetPropertyItemSize", _
         "ptr", $pBitmap, _
         "dword", 20736, _ ; PropertyTagFrameDelay
         "dword*", 0)

   If @error Or $a_iCall[0] Then
      DllCall("gdiplus.dll", "dword", "GdipDisposeImage", "ptr", $pBitmap)
      DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)
      Return SetError(9, 0, "")
   EndIf

   Local $iPropertyItemSize = $a_iCall[3]

   Local $tRawPropItem = DllStructCreate("byte[" & $iPropertyItemSize & "]")

   $a_iCall = DllCall("gdiplus.dll", "dword", "GdipGetPropertyItem", _
         "ptr", $pBitmap, _
         "dword", 20736, _ ; PropertyTagFrameDelay
         "dword", DllStructGetSize($tRawPropItem), _
         "ptr", DllStructGetPtr($tRawPropItem))

   If @error Or $a_iCall[0] Then
      DllCall("gdiplus.dll", "dword", "GdipDisposeImage", "ptr", $pBitmap)
      DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)
      Return SetError(10, 0, "")
   EndIf

   Local $tPropItem = DllStructCreate("int Id;" & _
         "dword Length;" & _
         "ushort Type;" & _
         "ptr Value", _
         DllStructGetPtr($tRawPropItem))

   Local $iSize = DllStructGetData($tPropItem, "Length") / 4 ; 'Delay Time' is dword type

   Local $tPropertyData = DllStructCreate("dword[" & $iSize & "]", DllStructGetData($tPropItem, "Value"))

   For $i = 0 To $iFrameCount - 1
      $aHBitmaps[$i][1] = DllStructGetData($tPropertyData, 1, $i + 1) * 10 ; 1 = 10 msec
      $aHBitmaps[$i][2] = $aHBitmaps[$i][1] ; read values
      If Not $aHBitmaps[$i][1] Then
         $aHBitmaps[$i][1] = 130 ; 0 is interpreted as 130 ms
      EndIf
      If $aHBitmaps[$i][1] < 50 Then ; will slow it down to prevent more extensive cpu usage
         $aHBitmaps[$i][1] = 50
      EndIf
   Next

   $iTransparency = 1 ; predefining

   $a_iCall = DllCall("gdiplus.dll", "dword", "GdipBitmapGetPixel", _
         "ptr", $pBitmap, _
         "int", 0, _  ; left
         "int", 0, _  ; upper
         "dword*", 0)

   If @error Or $a_iCall[0] Then
      DllCall("gdiplus.dll", "dword", "GdipDisposeImage", "ptr", $pBitmap)
      DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)
      Return SetError(11, 0, "")
   EndIf

   If $a_iCall[4] > 16777215 Then
      $iTransparency = 0
   EndIf

   DllCall("gdiplus.dll", "dword", "GdipDisposeImage", "ptr", $pBitmap)
   DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)

   Return SetError(0, 0, $aHBitmaps)

EndFunc  ;==>_CreateArrayHIconsFromGIFFile


; #FUNCTION# ;===============================================================================
;
; Name...........: _CreateArrayHIconsFromGIFBinaryImage
; Description ...: Create array of icon handles out of binary data
; Syntax.........: _CreateArrayHIconsFromGIFFile($sFile, ByRef $iWidth, ByRef $iHeight, ByRef $iTransparency)
; Remarks .......: This function if for internal useage by this script
; Author ........: trancexx (originally by ProgAndy)
;
;==========================================================================================
Func _CreateArrayHIconsFromGIFBinaryImage($bBinary, ByRef $iWidth, ByRef $iHeight, ByRef $iTransparency)

   Local $tBinary = DllStructCreate("byte[" & BinaryLen($bBinary) & "]")
   DllStructSetData($tBinary, 1, $bBinary)

   Local $a_hCall = DllCall("kernel32.dll", "hwnd", "GlobalAlloc", _
         "dword", 2, _  ; LMEM_MOVEABLE
         "dword", DllStructGetSize($tBinary))

   If @error Or Not $a_hCall[0] Then
      Return SetError(1, 0, "")
   EndIf

   Local $hMemory = $a_hCall[0]

   Local $a_pCall = DllCall("kernel32.dll", "ptr", "GlobalLock", "hwnd", $hMemory)

   If @error Or Not $a_pCall[0] Then
      DllCall("kernel32.dll", "int", "GlobalFree", "hwnd", $hMemory)
      Return SetError(2, 0, "")
   EndIf

   Local $pMemory = $a_pCall[0]

   DllCall("kernel32.dll", "none", "RtlMoveMemory", _
         "ptr", $pMemory, _
         "ptr", DllStructGetPtr($tBinary), _
         "dword", DllStructGetSize($tBinary))

   DllCall("kernel32.dll", "int", "GlobalUnlock", "hwnd", $hMemory)

   Local $a_iCall = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", _
         "ptr", $pMemory, _
         "int", 1, _
         "ptr*", 0)

   If @error Or $a_iCall[0] Then
      DllCall("kernel32.dll", "int", "GlobalFree", "hwnd", $hMemory)
      Return SetError(3, 0, "")
   EndIf

   Local $pStream = $a_iCall[3]

   Local $tGdiplusStartupInput = DllStructCreate("dword GdiplusVersion;" & _
         "ptr DebugEventCallback;" & _
         "int SuppressBackgroundThread;" & _
         "int SuppressExternalCodecs")

   DllStructSetData($tGdiplusStartupInput, "GdiplusVersion", 1)

   $a_iCall = DllCall("gdiplus.dll", "dword", "GdiplusStartup", _
         "dword*", 0, _
         "ptr", DllStructGetPtr($tGdiplusStartupInput), _
         "ptr", 0)

   If @error Or $a_iCall[0] Then
      DllCall("kernel32.dll", "int", "GlobalFree", "hwnd", $hMemory)
      Return SetError(4, 0, "")
   EndIf

   Local $hGDIplus = $a_iCall[1]

   $a_iCall = DllCall("gdiplus.dll", "dword", "GdipCreateBitmapFromStream", _ ; GdipLoadImageFromStream
         "ptr", $pStream, _
         "ptr*", 0)

   If @error Or $a_iCall[0] Then
      DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)
      DllCall("kernel32.dll", "int", "GlobalFree", "hwnd", $hMemory)
      Return SetError(5, 0, "")
   EndIf

   Local $pBitmap = $a_iCall[2]

   $a_iCall = DllCall("gdiplus.dll", "dword", "GdipGetImageDimension", _
         "ptr", $pBitmap, _
         "float*", 0, _
         "float*", 0)

   If @error Or $a_iCall[0] Then
      DllCall("gdiplus.dll", "dword", "GdipDisposeImage", "ptr", $pBitmap)
      DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)
      DllCall("kernel32.dll", "int", "GlobalFree", "hwnd", $hMemory)
      Return SetError(5, 0, "")
   EndIf

   $iWidth = $a_iCall[2]
   $iHeight = $a_iCall[3]

   $a_iCall = DllCall("gdiplus.dll", "dword", "GdipImageGetFrameDimensionsCount", _
         "ptr", $pBitmap, _
         "dword*", 0)

   If @error Or $a_iCall[0] Then
      DllCall("gdiplus.dll", "dword", "GdipDisposeImage", "ptr", $pBitmap)
      DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)
      DllCall("kernel32.dll", "int", "GlobalFree", "hwnd", $hMemory)
      Return SetError(8, 0, "")
   EndIf

   Local $iFrameDimensionsCount = $a_iCall[2]

   Local $tGUID = DllStructCreate("int;short;short;byte[8]")

   $a_iCall = DllCall("gdiplus.dll", "dword", "GdipImageGetFrameDimensionsList", _
         "ptr", $pBitmap, _
         "ptr", DllStructGetPtr($tGUID), _
         "dword", $iFrameDimensionsCount)

   If @error Or $a_iCall[0] Then
      DllCall("gdiplus.dll", "dword", "GdipDisposeImage", "ptr", $pBitmap)
      DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)
      DllCall("kernel32.dll", "int", "GlobalFree", "hwnd", $hMemory)
      Return SetError(9, 0, "")
   EndIf

   $a_iCall = DllCall("gdiplus.dll", "dword", "GdipImageGetFrameCount", _
         "ptr", $pBitmap, _
         "ptr", DllStructGetPtr($tGUID), _
         "dword*", 0)

   If @error Or $a_iCall[0] Then
      DllCall("gdiplus.dll", "dword", "GdipDisposeImage", "ptr", $pBitmap)
      DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)
      DllCall("kernel32.dll", "int", "GlobalFree", "hwnd", $hMemory)
      Return SetError(10, 0, "")
   EndIf

   Local $iFrameCount = $a_iCall[3]

   Local $aHBitmaps[$iFrameCount][3]

   For $i = 0 To $iFrameCount - 1

      $a_iCall = DllCall("gdiplus.dll", "dword", "GdipImageSelectActiveFrame", _
            "ptr", $pBitmap, _
            "ptr", DllStructGetPtr($tGUID), _
            "dword", $i)

      If @error Or $a_iCall[0] Then
         $aHBitmaps[$i][0] = 0
         ContinueLoop
      EndIf

      $a_iCall = DllCall("gdiplus.dll", "dword", "GdipCreateHICONFromBitmap", _
            "ptr", $pBitmap, _
            "hwnd*", 0)

      If @error Or $a_iCall[0] Then
         $aHBitmaps[$i][0] = 0
         ContinueLoop
      EndIf

      $aHBitmaps[$i][0] = $a_iCall[2]

   Next

   $a_iCall = DllCall("gdiplus.dll", "dword", "GdipGetPropertyItemSize", _
         "ptr", $pBitmap, _
         "dword", 20736, _ ; PropertyTagFrameDelay
         "dword*", 0)

   If @error Or $a_iCall[0] Then
      DllCall("gdiplus.dll", "dword", "GdipDisposeImage", "ptr", $pBitmap)
      DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)
      DllCall("kernel32.dll", "int", "GlobalFree", "hwnd", $hMemory)
      Return SetError(11, 0, "")
   EndIf

   Local $iPropertyItemSize = $a_iCall[3]

   Local $tRawPropItem = DllStructCreate("byte[" & $iPropertyItemSize & "]")

   $a_iCall = DllCall("gdiplus.dll", "dword", "GdipGetPropertyItem", _
         "ptr", $pBitmap, _
         "dword", 20736, _ ; PropertyTagFrameDelay
         "dword", DllStructGetSize($tRawPropItem), _
         "ptr", DllStructGetPtr($tRawPropItem))

   If @error Or $a_iCall[0] Then
      DllCall("gdiplus.dll", "dword", "GdipDisposeImage", "ptr", $pBitmap)
      DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)
      DllCall("kernel32.dll", "int", "GlobalFree", "hwnd", $hMemory)
      Return SetError(12, 0, "")
   EndIf

   Local $tPropItem = DllStructCreate("int Id;" & _
         "dword Length;" & _
         "ushort Type;" & _
         "ptr Value", _
         DllStructGetPtr($tRawPropItem))

   Local $iSize = DllStructGetData($tPropItem, "Length") / 4 ; 'Delay Time' is dword type

   Local $tPropertyData = DllStructCreate("dword[" & $iSize & "]", DllStructGetData($tPropItem, "Value"))

   For $i = 0 To $iFrameCount - 1
      $aHBitmaps[$i][1] = DllStructGetData($tPropertyData, 1, $i + 1) * 10 ; 1 = 10 msec
      $aHBitmaps[$i][2] = $aHBitmaps[$i][1] ; read values
      If Not $aHBitmaps[$i][1] Then
         $aHBitmaps[$i][1] = 130 ; 0 is interpreted as 130 ms
      EndIf
      If $aHBitmaps[$i][1] < 50 Then ; will slow it down to prevent more extensive cpu usage
         $aHBitmaps[$i][1] = 50
      EndIf
   Next

   $iTransparency = 1 ; predefining

   $a_iCall = DllCall("gdiplus.dll", "dword", "GdipBitmapGetPixel", _
         "ptr", $pBitmap, _
         "int", 0, _  ; left
         "int", 0, _  ; upper
         "dword*", 0)

   If @error Or $a_iCall[0] Then
      DllCall("gdiplus.dll", "dword", "GdipDisposeImage", "ptr", $pBitmap)
      DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)
      DllCall("kernel32.dll", "int", "GlobalFree", "hwnd", $hMemory)
      Return SetError(13, 0, "")
   EndIf

   If $a_iCall[4] > 16777215 Then
      $iTransparency = 0
   EndIf

   DllCall("gdiplus.dll", "dword", "GdipDisposeImage", "ptr", $pBitmap)
   DllCall("gdiplus.dll", "none", "GdiplusShutdown", "dword*", $hGDIplus)
   DllCall("kernel32.dll", "int", "GlobalFree", "hwnd", $hMemory)

   Return SetError(0, 0, $aHBitmaps)

EndFunc  ;==>_CreateArrayHIconsFromGIFBinaryImage



Được sửa bởi Admin ngày Thu Jul 18, 2013 4:21 pm; sửa lần 1.

Hãy cám ơn bài viết của Admin bằng cáh bấm vào "" nhe!!!

Về Đầu Trang Go down

https://haku.forumvi.net

s261999
Member
s261999

Tổng bài gửi : 62
Được Cảm Ơn : 12
Đến từ : Hồ Chí Minh
Tài năng của s261999
Hạng: Member
Level:62
Tài năng:/300

Bài gửiTiêu đề: Re: Code tạo khung thông báo cho Flash tặng ng iu Code tạo khung thông báo cho Flash tặng ng iu 3e45c23a204Sat Sep 29, 2012 10:29 am

h mới bik cách xài @@

Hãy cám ơn bài viết của s261999 bằng cáh bấm vào "" nhe!!!

Về Đầu Trang Go down

Tiêu đề

Code tạo khung thông báo cho Flash tặng ng iu

Xem chủ đề cũ hơn Xem chủ đề mới hơn Về Đầu Trang
Trang 1 trong tổng số 1 trang
::.
Permissions in this forum:Bạn không có quyền trả lời bài viết
Forum Häkü Cộng Đồng Chém Gió :: CONG NGHE THONG TIN :: Thủ thuật-