Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Die champions_big.dll lässt sich nicht löschen...
- Global Const $RT_RCDATA = 10
- Global Const $RT_BITMAP = 2
- DirCreate( @TempDir & "\LoL" )
- FileInstall ( ".\championdaten.ini", @TempDir & "\LoL\championdaten.ini", 1 )
- FileInstall ( ".\champions_big.dll", @TempDir & "\LoL\champions_big.dll", 1 )
- FileInstall ( ".\champions_small.dll", @TempDir & "\LoL\champions_small.dll", 1 )
- FileInstall ( ".\logo.jpg", @TempDir & "\LoL\logo.jpg", 1 )
- ; und zum löschen:
- Func BackgroundClose()
- GUIDelete()
- ;DirRemove ( @TempDir & "\LoL", 1 )
- Exit
- EndFunc
- ; auch versucht:
- Func BackgroundClose()
- GUIDelete()
- Sleep(2000)
- FileDelete ( @TempDir & "\LoL\champions_big.dll" )
- FileDelete ( @TempDir & "\LoL\champions_small.dll" )
- FileDelete ( @TempDir & "\LoL\championdaten.ini" )
- FileDelete ( @TempDir & "\LoL\logo.jpg" )
- DirRemove ( @TempDir & "\LoL", 1 )
- Exit
- EndFunc
- ;und auch dieser Versuch ist gescheitert (Endlosschleife):
- Func BackgroundClose()
- GUIDelete()
- Sleep(2000)
- Dim $delete = 0, $delete1 = 0, $delete2 = 0, $delete3 = 0, $delete4 = 0
- Do
- If $delete1 == 0 Then $delete1 = FileDelete ( @TempDir & "\LoL\champions_big.dll" )
- If $delete2 == 0 Then $delete2 = FileDelete ( @TempDir & "\LoL\champions_small.dll" )
- If $delete3 == 0 Then $delete3 = FileDelete ( @TempDir & "\LoL\championdaten.ini" )
- If $delete4 == 0 Then $delete4 = FileDelete ( @TempDir & "\LoL\logo.jpg" )
- If $delete1 And $delete2 And $delete3 And $delete4 Then $delete = 1
- Until $delete == 1
- DirRemove ( @TempDir & "\LoL", 1 )
- Exit
- EndFunc
- ; Hier die Funktion die ich nutze zum nutzen der dll:
- Func _SetImagefromResource($CtrlID, $Resname, $Resfile = -1, $ResType = 10)
- ;Diese Funktion basiert auf der UDF von [email protected] und Code von [email protected]
- Local Const $IMAGE_BITMAP = 0
- Local Const $STM_SETIMAGE = 0x0172
- Local $hmod, $hwnd, $InfoBlock, $ResSize, $Mem, $pMem, $dll, $dll2, $hData, $pData, $pStream, $ret, $hBitmap, $pBitmap
- If $Resfile = -1 Then
- $hmod = _WinAPI_GetModuleHandle("")
- Else
- $hmod = _WinAPI_LoadLibrary($Resfile)
- EndIf
- If $ResType = $RT_BITMAP Then
- $hBitmap = _WinAPI_LoadImage($hmod, $Resname, $IMAGE_BITMAP, 0, 0, 0)
- If @error Then Return SetError(1, 0, 0)
- $hwnd = GUICtrlGetHandle($CtrlID)
- If $hwnd = 0 Then Return SetError(2, 0, 0)
- DllCall("user32.dll", "hwnd", "SendMessage", "hwnd", $hwnd, "int", $STM_SETIMAGE, "int", $IMAGE_BITMAP, "int", $hBitmap)
- If @error Then Return SetError(3, 0, 0)
- Else
- $InfoBlock = DllCall("kernel32.dll", "int", "FindResourceA", "int", $hmod, "str", $Resname, "long", $ResType)
- If @error Then Return SetError(4, 0, 0)
- $InfoBlock = $InfoBlock[0]
- If $InfoBlock = 0 Then Return SetError(5, 0, 0)
- $ResSize = DllCall("kernel32.dll", "dword", "SizeofResource", "int", $hmod, "int", $InfoBlock)
- If @error Then Return SetError(6, 0, 0)
- $ResSize = $ResSize[0]
- If $ResSize = 0 Then Return SetError(7, 0, 0)
- $Mem = DllCall("kernel32.dll", "int", "LoadResource", "int", $hmod, "int", $InfoBlock)
- If @error Then Return SetError(8, 0, 0)
- $Mem = $Mem[0]
- If $Mem = 0 Then Return SetError(9, 0, 0)
- $pMem = DllCall("kernel32.dll", "int", "LockResource", "int", $Mem)
- If @error Then Return SetError(8, 0, 0)
- $pMem = $pMem[0]
- If $pMem = 0 Then Return SetError(10, 0, 0)
- If $Resfile <> -1 Then DllCall("Kernel32.dll", "int", "FreeLibrary", "str", $hmod)
- $hData = _MemGlobalAlloc($ResSize, 2)
- $pData = _MemGlobalLock($hData)
- _MemMoveMemory($pMem, $pData, $ResSize)
- _MemGlobalUnlock($hData)
- $ret = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "int", $hData, "long", 1, "Int*", 0)
- $pStream = $ret[3]
- _GDIPlus_Startup()
- $pBitmap = DllCall($ghGDIPDll, "int", "GdipCreateBitmapFromStream", "ptr", $pStream, "int*", 0)
- $pBitmap = $pBitmap[2]
- $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($pBitmap)
- $hwnd = GUICtrlGetHandle($CtrlID)
- If $hwnd = 0 Then Return SetError(11, 0, 0)
- DllCall("user32.dll", "hwnd", "SendMessage", "hwnd", $hwnd, "int", $STM_SETIMAGE, "int", $IMAGE_BITMAP, "int", $hBitmap)
- If @error Then Return SetError(12, 0, 0)
- _GDIPlus_BitmapDispose($pBitmap)
- _GDIPlus_Shutdown()
- $dll = DllStructCreate("Uint", $pStream)
- $dll2 = DllStructCreate("uInt", DllStructGetData($dll, 1) + 8)
- DllCall("", "UInt", DllStructGetData($dll2, 1), "UInt", $pStream)
- _WinAPI_DeleteObject($pStream)
- $pStream = 0
- _MemGlobalFree($hData)
- EndIf
- EndFunc ;==>_SetImagefromResource
- ; und hier mal ein Aufruf:
- _SetImagefromResource($ChampGross, StringUpper($sText), @TempDir & "\LoL\champions_big.dll", $RT_RCDATA)
Advertisement
Add Comment
Please, Sign In to add comment