#include #include #include _SQLite_Startup() _SQLite_Open(@ScriptDir & "\Innopad.db") Global $aRow _SQLite_QuerySingleRow(-1, "SELECT thumbnail FROM Games_info where pkey='3'", $aRow) _SQLite_Close() _SQLite_Shutdown() GUICreate("Test") $imgIcon = GUICtrlCreatePic("", 10, 10, 57, 57) GUISetState() $hLblDC = _WinAPI_GetDC(GUICtrlGetHandle($imgIcon)) $hBitmap = _WinAPI_CreateCompatibleBitmap($hLblDC, 57, 57) $hDC = _WinAPI_CreateCompatibleDC($hLblDC) _WinAPI_SelectObject($hDC, $hBitmap) $aRow[0] = BinaryMid($aRow[0], 9, BinaryLen($aRow[0])-9) Dim $newRow For $i = 1 To BinaryLen($aRow[0]) Step 171 ConsoleWrite("OLD:" & BinaryMid($aRow[0], $i, 171) & '00' & @CRLF) $newRow &= BinaryToString(BinaryMid($aRow[0], $i, 171) & BinaryMid(0x00,1,2)) ConsoleWrite("NEW:" & BinaryMid($newRow, $i, 173) & @CRLF & @CRLF) ;EXITLOOP Next $newRow = Binary($newRow) ;ConsoleWrite("NEW ROW:" & @CRLF) ;ConsoleWrite($newRow & @CRLF) ;EXIT ;ConsoleWrite($aRow[0] & @CRLF) ;$tData = DllStructCreate("byte[" & BinaryLen($aRow[0]) & "]") ;DllStructSetData($tData, 1, $aRow[0]) MsgBox(0,"",BinaryLen($aRow[0]) & @CRLF & BinaryLen($newRow)) $tData = DllStructCreate("byte[" & BinaryLen($newRow) & "]") DllStructSetData($tData, 1, $newRow) $tBITMAPINFOHEADER = DllStructCreate("DWORD biSize;LONG biWidth;LONG biHeight;WORD biPlanes;WORD biBitCount;DWORD biCompression;DWORD biSizeImage;LONG biXPelsPerMeter;LONG biYPelsPerMeter;DWORD biClrUsed;DWORD biClrImportant; DWORD colormap[3]") DllStructSetData($tBITMAPINFOHEADER, 1, DllStructGetSize($tBITMAPINFOHEADER)) DllStructSetData($tBITMAPINFOHEADER, 2, 57) DllStructSetData($tBITMAPINFOHEADER, 3, -57) DllStructSetData($tBITMAPINFOHEADER, 4, 1) DllStructSetData($tBITMAPINFOHEADER, 5, 16) ; use default GDI32 16 bit format: 5-5-5 DllStructSetData($tBITMAPINFOHEADER, 6, 0) ; Choose Colormask manually, example for 5-5-5 ;~ DllStructSetData($tBITMAPINFOHEADER, 6, 3) ;BI_BITFIELDS ;~ DllStructSetData($tBITMAPINFOHEADER, "colormap", 0x7C00, 1) ;- Red mask ;~ DllStructSetData($tBITMAPINFOHEADER, "colormap", 0x03E0, 2) ;- Green mask ;~ DllStructSetData($tBITMAPINFOHEADER, "colormap", 0x001F, 3) ;- Blue mask _WinAPI_SetDIBits($hLblDC, $hBitmap, 0, 57, DllStructGetPtr($tData), DllStructGetPtr($tBITMAPINFOHEADER), 1) _WinAPI_ReleaseDC(GUICtrlGetHandle($imgIcon), $hLblDC) _WinAPI_DeleteDC($hDC) _GUICtrlStatic_SetImage($imgIcon, $hBitmap) While GUIGetMsg()<>-3 WEnd ; #FUNCTION# ==================================================================================================================== ; Name...........: _GUICtrlStatic_SetImage ; Description ...: Sets a HBITMAP to a static control like image or label ; Syntax.........: _GUICtrlStatic_SetImage($iCtrlId, $hBitmap) ; Parameters ....: $iCtrlId - CtrlId or handle of Control in the current process ; $hBitmap - Pointer top Windows HBITMAP ; Return values .: Success - 1 ; Failure - 0 and set @error: ; |1 - invalid $pSource ; |1 - invalid $pSource ; Author ........: ProgAndy, Zedna ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _GUICtrlStatic_SetImage($iCtrlId, $hBitmap) Local Const $STM_SETIMAGE = 0x0172 Local Const $IMAGE_BITMAP = 0 Local Const $SS_BITMAP = 0xE Local Const $GWL_STYLE = -16 If IsHWnd($iCtrlId) Then If WinGetProcess($iCtrlId) <> @AutoItPID Then Return SetError(1,0,0) Else $iCtrlId = GUICtrlGetHandle($iCtrlId) If Not $iCtrlId Then Return SetError(2,0,0) EndIf ; set SS_BITMAP style to control Local $oldStyle = DllCall("user32.dll", "long", "GetWindowLong", "hwnd", $iCtrlId, "int", $GWL_STYLE) If @error Then Return SetError(3, 0, 0) DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $iCtrlId, "int", $GWL_STYLE, "long", BitOR($oldStyle[0], $SS_BITMAP)) If @error Then Return SetError(4, 0, 0) Local $oldBmp = DllCall("user32.dll", "handle", "SendMessageW", "hwnd", $iCtrlId, "int", $STM_SETIMAGE, "wparam", $IMAGE_BITMAP, "handle", $hBitmap) If @error Then Return SetError(5, 0, 0) If $oldBmp[0] Then _WinAPI_DeleteObject($oldBmp[0]) Return 1 EndFunc