Comme c'est mon premier post ici, je salut tout le monde !
Voila, j'utilise autoit pour developper une appli qui se connecte a une base de donnée access, gerée par une application tiers (elle developpée en VB6, aucun controle dessus). Dans cette meme appli VB6, il y a un controle picturebox. Ce que je cherche a faire, c'est de sauver le contenu (l'image) de ce picturebox vers le disk (jusque la tout est ok) et ensuite renvoyer l'image sauver sur le disque vers le picturebox.
Pour la recuperation de l'image, j'utilise les functions suivantes:
1 - je recupere le handle du picturebox de l'appli tiers et je l'envoi a _saveBitmap()
2 - l'image est sauvée dans mes docs
Code : Tout sélectionner
Func _saveBitmap($hWnd)
$hBitmap = BitmapCreateFromControlHWND($HWND)
_GDIPlus_Startup ()
$hImage1 = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap)
_GDIPlus_ImageSaveToFile ($hImage1, @MyDocumentsDir & "\GDIPlus_Image.bmp")
_GDIPlus_BitmapDispose ($hImage1)
_GDIPlus_ShutDown ()
If @error Then Return -1
Return 1
EndFunc
Func BitmapCreateFromControlHWND($hWnd)
Local $Width = _WinAPI_GetWindowWidth($hWnd)
Local $Height =_WinAPI_GetWindowHeight($hWnd)
$hDC = _WinAPI_GetDC($hWnd)
$CompatibleDC = _WinAPI_CreateCompatibleDC($hDC)
$hBitmap = _WinAPI_CreateCompatibleBitmap($hDC,$Width -4, $Height -4)
_WinAPI_SelectObject($CompatibleDC, $hBitmap)
_WinAPI_BitBlt($CompatibleDC, 0, 0, $Width, $Height, $hDC, 0, 0, $SRCCOPY );$SRCCOPY
_WinAPI_DeleteObject($hBitmap)
_WinAPI_ReleaseDC($hWnd, $hDC)
If Not $hBitmap Then Return SetError(1, 0, 0)
Return $hBitmap
EndFunc
Merci a tous pour votre aide

