Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

WinAPI_DuplicateHandle ?

$
0
0
Hi people.
I found this script in example section  but  when i want to compile the script it throws that error



Quote

UDFs\WinAPIEx.au3(6723,104) : ERROR: _WinAPI_DuplicateHandle() already defined.
Func _WinAPI_DuplicateHandle($hProcess, $hSource, $hTarget, $iAccess = 0, $iOptions = 2, $fInherit = 0)

the main script is this
[ autoit ]         
#Include <WindowsConstants.au3> #include <GDIPlus.au3> #Include <Misc.au3> #Include <Sound.au3> #Include "UDFs\WinAPIEx.au3" #include "UDFs\sound_udf.au3" If _Singleton("UCestitkaPL", 1) = 0 Then Exit MsgBox(48 + 262144, "Cestitka IN", "Cestitka je vec pokrenuta!", 4) DirCreate(@TempDir & "\Cestitka2011") FileInstall("snijeg\s1.png", @TempDir & "\Cestitka2011\s1.png", 1) FileInstall("snijeg\s2.png", @TempDir & "\Cestitka2011\s2.png", 1) FileInstall("snijeg\s3.png", @TempDir & "\Cestitka2011\s3.png", 1) FileInstall("snijeg\s4.png", @TempDir & "\Cestitka2011\s4.png", 1) FileInstall("snijeg\s5.png", @TempDir & "\Cestitka2011\s5.png", 1) FileInstall("snijeg\s6.png", @TempDir & "\Cestitka2011\s6.png", 1) FileInstall("snijeg\s7.png", @TempDir & "\Cestitka2011\s7.png", 1) FileInstall("snijeg\s8.png", @TempDir & "\Cestitka2011\s8.png", 1) FileInstall("snijeg\s9.png", @TempDir & "\Cestitka2011\s9.png", 1) FileInstall("snijeg\s10.png", @TempDir & "\Cestitka2011\s10.png", 1) FileInstall("snijeg\s11.png", @TempDir & "\Cestitka2011\s11.png", 1) FileInstall("snijeg\s12.png", @TempDir & "\Cestitka2011\s12.png", 1) FileInstall("pjesma.mp3", @TempDir & "\Cestitka2011\pjesma.mp3", 1) FileInstall("podloga2.png", @TempDir & "\Cestitka2011\podloga2.png", 1) FileInstall("mail2.png", @TempDir & "\Cestitka2011\mail2.png", 1) FileInstall("santa3.gif", @TempDir & "\Cestitka2011\santa3.gif", 1) FileInstall("santa2.gif", @TempDir & "\Cestitka2011\santa2.gif", 1) FileInstall("snijeg.exe", @TempDir & "\Cestitka2011\snijeg.exe", 1) FileInstall("posta.exe", @TempDir & "\Cestitka2011\posta.exe", 1) FileInstall("podloga3.png", @TempDir & "\Cestitka2011\podloga3.png", 1) FileInstall("podloga4.png", @TempDir & "\Cestitka2011\podloga4.png", 1) FileInstall("tekst.png", @TempDir & "\Cestitka2011\tekst.png", 1) FileInstall("tekst2.png", @TempDir & "\Cestitka2011\tekst2.png", 1) FileInstall("b1.png", @TempDir & "\Cestitka2011\b1.png", 1) FileInstall("b2.png", @TempDir & "\Cestitka2011\b2.png", 1) IniWrite(@TempDir & "\Cestitka2011\Status.ini", "Start", "OK", 0) HotKeySet("{ESC}", "CloseAll") Global $b1, $b2 Do Sleep(100) Until FileExists(@TempDir & "\Cestitka2011\Status.ini") If _SoundGetMasterMute() = 1 Then _SoundSetMasterMute(0) _SoundSetMasterVolume(20) Global $music = _SoundOpen(@TempDir & "\Cestitka2011\pjesma.mp3") _SoundPlay($music) Global $ww = @DesktopWidth, $hh = @DesktopHeight _GDIPlus_Startup() Global $hGUI2 = GUICreate("", $ww, $hh, 0, 0, $WS_POPUP, -1, 0x80) GUISetBkColor(0x000000, $hGUI2) WinSetTrans($hGUI2, "", 0) WinSetOnTop($hGUI2, "", 1) GUISetState() For $i = 0 To 255 Step 17 WinSetTrans($hGUI2, "", $i) Next Global $hForm = GUICreate("CESTITKA_PL", $ww, $hh, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) Global $lab = GUICtrlCreateLabel("", $ww - 170, 25, 128, 35) $podl = _GDIPlus_ImageLoadFromFile(@TempDir & "\Cestitka2011\podloga2.png") $hGr1a = _GDIPlus_GraphicsCreateFromHWND($hForm) $hBmpa = _GDIPlus_BitmapCreateFromGraphics($ww, $hh, $hGr1a) $hGr2a = _GDIPlus_ImageGetGraphicsContext($hBmpa) _GDIPlus_GraphicsDrawImageRect($hGr2a, $podl, 0, 0, $ww, $hh) _GDIPlus_GraphicsDispose($hGr2a) _GDIPlus_GraphicsDispose($hGr1a) _GDIPlus_ImageDispose($podl) For $i = 0 To 255 Step 17 SetBitmap($hForm, $hBmpa, $i) Next _GDIPlus_GraphicsDispose($hBmpa) GUIDelete($hGUI2) GUISetState() ShellExecute(@TempDir & "\Cestitka2011\snijeg.exe") Sleep(1200) GIFs(@TempDir & "\Cestitka2011\santa3.gif", @TempDir & "\Cestitka2011\santa2.gif", $hForm, 50, -540, $ww, 10, -530, $ww, 10) ProcessWaitClose("posta.exe") Global $hGUI2 = GUICreate("", $ww, $hh, 0, 0, $WS_POPUP, -1, $hForm) GUISetBkColor(0x000000, $hGUI2) WinSetTrans($hGUI2, "", 0) WinSetOnTop($hGUI2, "", 1) GUISetState() For $i = 0 To 255 Step 17 WinSetTrans($hGUI2, "", $i) Next Global $podl3 = _GDIPlus_ImageLoadFromFile(@TempDir & "\Cestitka2011\podloga3.png") $hGr1a = _GDIPlus_GraphicsCreateFromHWND($hForm) $hBmpa = _GDIPlus_BitmapCreateFromGraphics($ww, $hh, $hGr1a) $hGr2a = _GDIPlus_ImageGetGraphicsContext($hBmpa) _GDIPlus_GraphicsDrawImageRect($hGr2a, $podl3, 0, 0, $ww, $hh) _GDIPlus_GraphicsDispose($hGr2a) _GDIPlus_GraphicsDispose($hGr1a) SetBitmap($hForm, $hBmpa, 255) _GDIPlus_ImageDispose($podl3) _GDIPlus_GraphicsDispose($hBmpa) WinSetOnTop($hGUI2, "", 0) GUIDelete($hGUI2) Sleep(2000) Global $hGUI3 = GUICreate("", 705, 265, (($ww / 2) - (705 / 2)) + 0.04 * $ww, (($hh / 2) - (265 / 2)) - 0.03 * $hh, $WS_POPUP, $WS_EX_LAYERED, $hForm) WinSetOnTop($hGUI3, "", 1) GUISetState() Global $podl4 = _GDIPlus_ImageLoadFromFile(@TempDir & "\Cestitka2011\tekst.png") For $i = 0 To 255 Step 17 SetBitmap($hGUI3, $podl4, $i) Next ;_GDIPlus_ImageDispose($podl4) Sleep(11000) For $i = 255 To 0 Step -17 SetBitmap($hGUI3, $podl4, $i) Next _GDIPlus_ImageDispose($podl4) GUIDelete($hGUI3) Global $hGUI2 = GUICreate("", $ww, $hh, 0, 0, $WS_POPUP, -1, $hForm) GUISetBkColor(0x000000, $hGUI2) WinSetTrans($hGUI2, "", 0) WinSetOnTop($hGUI2, "", 1) GUISetState() For $i = 0 To 255 Step 17 WinSetTrans($hGUI2, "", $i) Next Global $podl3 = _GDIPlus_ImageLoadFromFile(@TempDir & "\Cestitka2011\podloga4.png") $hGr1a = _GDIPlus_GraphicsCreateFromHWND($hForm) $hBmpa = _GDIPlus_BitmapCreateFromGraphics($ww, $hh, $hGr1a) $hGr2a = _GDIPlus_ImageGetGraphicsContext($hBmpa) _GDIPlus_GraphicsDrawImageRect($hGr2a, $podl3, 0, 0, $ww, $hh) _GDIPlus_GraphicsDispose($hGr2a) _GDIPlus_GraphicsDispose($hGr1a) SetBitmap($hForm, $hBmpa, 255) _GDIPlus_ImageDispose($podl3) _GDIPlus_GraphicsDispose($hBmpa) WinSetOnTop($hGUI2, "", 0) GUIDelete($hGUI2) Sleep(2000) Global $hGUI3 = GUICreate("", 523, 309, (($ww / 2) - (523 / 2)) - 0.11 * $ww, (($hh / 2) - (309 / 2)) - 0.06 * $hh, $WS_POPUP, $WS_EX_LAYERED, $hForm) GUISetState() Global $podl4 = _GDIPlus_ImageLoadFromFile(@TempDir & "\Cestitka2011\tekst2.png") For $i = 0 To 255 Step 17 SetBitmap($hGUI3, $podl4, $i) Next _GDIPlus_ImageDispose($podl4) Global $hGUI4 = GUICreate("", 128, 35, $ww - 170, 25, $WS_POPUP, $WS_EX_LAYERED, $hForm) WinSetOnTop($hGUI4, "", 1) GUISetState() Global $b1 = _GDIPlus_ImageLoadFromFile(@TempDir & "\Cestitka2011\b1.png") Global $b2 = _GDIPlus_ImageLoadFromFile(@TempDir & "\Cestitka2011\b2.png") SetBitmap($hGUI4, $b1) $state = 0 While 1 If GUIGetMsg() = -3 Then CloseAll() If _SoundStatus($music) = "stopped" Then CloseAll() $pos = GUIGetCursorInfo($hForm) If $pos[4] = $lab Then If $pos[3] = 1 Then ContinueLoop If $pos[2] = 1 Then ContinueLoop While $pos[4] = $lab If GUIGetMsg() = -3 Then CloseAll() $pos = GUIGetCursorInfo($hForm) Switch $pos[2] Case 0; not pressed If $state <> 1 Then SetBitmap($hGUI4, $b2) $state = 1 EndIf Case 1; pressed CloseAll() EndSwitch Sleep(10) WEnd SetBitmap($hGUI4, $b1) $state = 0 EndIf Sleep(10) WEnd Func CloseAll() ProcessClose("snijeg.exe") Do Sleep(50) Until Not ProcessExists("snijeg.exe") _SoundClose($music) _GDIPlus_ImageDispose($b1) _GDIPlus_ImageDispose($b2) _GDIPlus_Shutdown() GUIDelete($hForm) Sleep(500) DirRemove(@TempDir & "\Cestitka2011", 1) Exit EndFunc Func GIFs($Gif, $Gif2, $PAR, $ASPD, $x1, $x2, $stps, $x3, $x4, $stps2) Local $i = 0, $ApX, $ApY, $ApW, $ApH, $eX, $eY, $ix2 = $x2 $hImage = _GDIPlus_ImageLoadFromFile($Gif) $ApW = _GDIPlus_ImageGetWidth($hImage) $ApH = _GDIPlus_ImageGetHeight($hImage) $yy = ($hh / 2) - ($ApH / 2) $hGUI = GUICreate("", $ApW, $ApH, $ww, $yy - 150, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_DISABLED), $PAR) GUISetState() $iBegin = TimerInit() While 1 $tDL = DllStructCreate($tagGUID) $pDimensionIDs = DllStructGetPtr($tDL) $GFDC = DllCall($ghGDIPDll, "int", "GdipImageGetFrameDimensionsCount", "ptr", $hImage, "int*", 0) DllCall($ghGDIPDll, "int", "GdipImageGetFrameDimensionsList", "ptr", $hImage, "ptr", $pDimensionIDs, "int", $GFDC[2]) $GFC = DllCall($ghGDIPDll, "int", "GdipImageGetFrameCount", "int", $hImage, "ptr", $pDimensionIDs, "int*", 0) If $i = $GFC[3] Then $i = 0 DllCall($ghGDIPDll, "int", "GdipImageSelectActiveFrame", "ptr", $hImage, "ptr", $pDimensionIDs, "int", $i) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hScrDC = _WinAPI_GetDC($hGUI) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) DllStructSetData($tSize, "X", $ApW) DllStructSetData($tSize, "Y", $ApH) $pSize = DllStructGetPtr($tSize) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) DllStructSetData($tBlend, "Alpha", 255) DllStructSetData($tBlend, "Format", 1) $pBlend = DllStructGetPtr($tBlend) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) ;If $ix2 - $stps <= $x1 Then $ix2 = $x2 If $ix2 - $stps <= $x1 Then ExitLoop WinMove($hGUI, "", $ix2 - $stps, $yy - 150) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) Sleep($ASPD) $i += 1 $ix2 -= $stps WEnd _GDIPlus_ImageDispose($hImage) Sleep(1500) Local $start = 1 Local $i = 0, $ApX, $ApY, $ApW, $ApH, $eX, $eY, $ix1 = $x3 _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile($Gif2) $ApW = _GDIPlus_ImageGetWidth($hImage) $ApH = _GDIPlus_ImageGetHeight($hImage) $yy = ($hh / 2) - ($ApH / 2) WinMove($hGUI, "", -550, $yy) ;$hGUI = GUICreate("", $ApW, $ApH, -550, $yy, $WS_POPUP, $WS_EX_LAYERED, $PAR) ;GUISetState() $iBegin = TimerInit() While 1;TimerDiff($iBegin) <= $TOUT $tDL = DllStructCreate($tagGUID) $pDimensionIDs = DllStructGetPtr($tDL) $GFDC = DllCall($ghGDIPDll, "int", "GdipImageGetFrameDimensionsCount", "ptr", $hImage, "int*", 0) DllCall($ghGDIPDll, "int", "GdipImageGetFrameDimensionsList", "ptr", $hImage, "ptr", $pDimensionIDs, "int", $GFDC[2]) $GFC = DllCall($ghGDIPDll, "int", "GdipImageGetFrameCount", "int", $hImage, "ptr", $pDimensionIDs, "int*", 0) If $i = $GFC[3] Then $i = 0 DllCall($ghGDIPDll, "int", "GdipImageSelectActiveFrame", "ptr", $hImage, "ptr", $pDimensionIDs, "int", $i) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hScrDC = _WinAPI_GetDC($hGUI) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) DllStructSetData($tSize, "X", $ApW) DllStructSetData($tSize, "Y", $ApH) $pSize = DllStructGetPtr($tSize) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) DllStructSetData($tBlend, "Alpha", 255) DllStructSetData($tBlend, "Format", 1) $pBlend = DllStructGetPtr($tBlend) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) ;If $ix2 - $stps <= $x1 Then $ix2 = $x2 If $ix1 + $stps >= ($x2 / 2) - 50 Then If $start = 1 Then ShellExecute(@TempDir & "\Cestitka2011\posta.exe") $start = 0 While 1 If IniRead(@TempDir & "\Cestitka2011\Status.ini", "Start", "OK", 0) = 1 Then ExitLoop Sleep(100) WEnd EndIf EndIf If $ix1 + $stps >= $x4 Then ExitLoop WinMove($hGUI, "", $ix1 + $stps, $yy + 100) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) Sleep($ASPD) $i += 1 $ix1 += $stps WEnd _GDIPlus_ImageDispose($hImage) ;_GDIPlus_Shutdown() GUIDelete($hGUI) EndFunc Func SetBitmap($hGUI, $hImage, $iOpacity = 255) Local $hScrDC = _WinAPI_GetDC(0) Local $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) Local $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate("long X;long Y") $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate("long X;long Y") $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate("byte Op;byte Flags;byte Alpha;byte Format") $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", 1) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, 0x02) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>SetBitmap

the original link is this

I just want to change the wallpaper and song.

Thank you in advance

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>