cs_hippo92210b
Messages postés59Date d'inscriptionlundi 12 février 2007StatutMembreDernière intervention 9 décembre 2009
-
4 juil. 2009 à 14:38
cs_hippo92210b
Messages postés59Date d'inscriptionlundi 12 février 2007StatutMembreDernière intervention 9 décembre 2009
-
4 juil. 2009 à 18:54
Bonjour,
Voila, je voudrais savoir si quelqu'un sait comment envoyer une image par winsock sans passer par le disque dur, d'une image box a une autre image box, voila.
bmType As Long
bmWidth As Long
bmHeight As Long
bmWidthBytes As Long
bmPlanes As Integer
bmBitsPixel As Integer
bmBits As Long
End Type
Private Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As
Long
Private Declare Function GetBitmapBits Lib "gdi32" (ByVal hBitmap As Long, ByVal dwCount As Long, lpBits As Any) As
Long
Function PictureToArray(ByRef img As IPicture) As Byte()
Dim tBM As BITMAP
Dim abRet() As Byte
Dim lSize As Long
'
structure
Call GetObject(img.handle, Len(tBM), tBM)
' préparation du tableau
lSize = (tBM.bmWidth * 3) And &HFFFFFFFC
ReDim abRet(0 To lSize * tBM.bmHeight * 3)
' attribution,
retour
Call GetBitmapBits(img.handle, UBound(abRet), abRet(0))
PictureToArray = abRet
Erase abRet
End Function
'ArrayToPicture a, Picture2.Image
'Picture2.Refresh
'
'NB
: le tableau de bytes 'a' doit être valide, voir la fonction inverse
correspondante
:
'http://www.codyx.org/snippet_transformer-image-picturebox-tableau-bytes_496.aspx#2389