Là tabarnack je suis à près perdre patience calise. J'ai un objet bitmap que
je dois sauvegarder dans un fichier du même type. pour ensuite l'encrypter
dans une librairie protégé. Là le problème est que je dois sauvegarder le
bitmap en fichier et hje suis pas capable, j'utilise la fonction SAVE de
BITMAP mais christ ca marche pâs, et pourtant je fourni le bon argument, SVP
je suis a bout là!
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Christian Hugoud
Mets un bout du code que nous puissions t'aider.
Christian
"Jean Christophe Avard" a écrit dans le message de news:
Là tabarnack je suis à près perdre patience calise. J'ai un objet bitmap que je dois sauvegarder dans un fichier du même type. pour ensuite l'encrypter dans une librairie protégé. Là le problème est que je dois sauvegarder le bitmap en fichier et hje suis pas capable, j'utilise la fonction SAVE de BITMAP mais christ ca marche pâs, et pourtant je fourni le bon argument, SVP je suis a bout là!
Mets un bout du code que nous puissions t'aider.
Christian
"Jean Christophe Avard" <NO.SP@M.BITCH> a écrit dans le message de news:
u9vAjAF9FHA.600@tk2msftngp13.phx.gbl...
Là tabarnack je suis à près perdre patience calise. J'ai un objet bitmap
que je dois sauvegarder dans un fichier du même type. pour ensuite
l'encrypter dans une librairie protégé. Là le problème est que je dois
sauvegarder le bitmap en fichier et hje suis pas capable, j'utilise la
fonction SAVE de BITMAP mais christ ca marche pâs, et pourtant je fourni
le bon argument, SVP je suis a bout là!
"Jean Christophe Avard" a écrit dans le message de news:
Là tabarnack je suis à près perdre patience calise. J'ai un objet bitmap que je dois sauvegarder dans un fichier du même type. pour ensuite l'encrypter dans une librairie protégé. Là le problème est que je dois sauvegarder le bitmap en fichier et hje suis pas capable, j'utilise la fonction SAVE de BITMAP mais christ ca marche pâs, et pourtant je fourni le bon argument, SVP je suis a bout là!
Jean Christophe Avard
Ça c'est le code que j'ai lorsque je drop un fichier dans mon application
Private Sub ListView1_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListView1.DragDrop
Dim cnn As New OleDbConnection(CONST_CONNECTION_STRING)
Dim cmm As New OleDbCommand
Dim newms As MemoryStream
Dim img As Image
Dim sFile() As String
Dim itm As New ListViewItem
Dim index As Integer = ImageList2.Images.Count
Dim i, id As Integer
Dim sLib, sFilename As String
Try
If e.Data.GetDataPresent(DataFormats.FileDrop) Then ' Image File being dropped
sFile = e.Data.GetData(DataFormats.FileDrop)
pBar.Visible = True
pBar.Minimum = 1
pBar.Maximum = sFile.Length
pBar.Value = 1
pBar.Step = 1
For i = 0 To sFile.Length - 1
' vérifie s'il s'agit d'une fichier d'image
Dim ImgTest As Image = Image.FromFile(sFile(i))
ImgTest = Nothing
' appele la function qui ajoute l'image
addImage(sFile(i))
pBar.PerformStep()
Application.DoEvents()
Next
ElseIf e.Data.GetDataPresent(DataFormats.Dib) Then ' Image dragged from Corel Designer
Public Sub HandleDropOrPaste(ByRef data As DataObject)
' --- CF_BITMAP test ---
' This line uses the CF_BITMAP data to create a bitmap object directly...
' _bmp = data.GetData(DataFormats.Bitmap)
' --- CF_DIB test ---
' From here we need to create a Bitmap object from the MemoryStream that contains the CF_DIB data
' But we also need to prepend the data with a BITMAPFILEHEADER
' This pulls the bitmap data from the clipboard. It does not contain a BITMAPFILEHEADER...
Dim stm As MemoryStream = data.GetData(DataFormats.Dib)
If stm Is Nothing Then
Return
End If
' Read the data from the stream above into a Byte array...
Dim bytes(stm.Length) As Byte
Dim i As Integer
i = stm.Read(bytes, 0, stm.Length)
stm.Close()
If i = 0 Then
Return
End If
' Setup a BITMAPFILEHEADER which we need before the clipboard data...
Dim bmf As New BITMAPFILEHEADER
bmf.bfType = UInt16.Parse(&H4D42)
bmf.bfSize = UInt32.Parse(BMFSIZE + i)
bmf.bfReserved1 = UInt16.Parse(0)
bmf.bfReserved2 = UInt16.Parse(0)
bmf.bfOffBits = UInt32.Parse(BMFSIZE + BMIHSIZE)
' Create a new stream (newstm) which we will fill with all the data we need...
Dim newstm As New MemoryStream(BMFSIZE + i)
If newstm Is Nothing Then
Return
End If
' Put the BITMAPFILEHEADER (which we initialized above) into newstm...
Dim bmfPtr As New IntPtr
bmfPtr = Marshal.AllocHGlobal(BMFSIZE)
Marshal.StructureToPtr(bmf, bmfPtr, True)
Dim bmfBytes(BMFSIZE) As Byte
Marshal.Copy(bmfPtr, bmfBytes, 0, BMFSIZE)
newstm.Write(bmfBytes, 0, BMFSIZE)
Marshal.FreeHGlobal(bmfPtr)
' Put the data we copied from the clipboard into newstm following BITMAPFILEHEADER...
newstm.Write(bytes, 0, i)
' Finally, create a new bitmap using the assembled stream...
If newstm.Length > 0 Then
_bmp = New Bitmap(newstm)
End If
' Cleanup and force a redraw...
newstm.Close()
'Me.Invalidate()
End Sub
End Module
"Christian Hugoud" wrote in message news:
Mets un bout du code que nous puissions t'aider.
Christian
"Jean Christophe Avard" a écrit dans le message de news:
Là tabarnack je suis à près perdre patience calise. J'ai un objet bitmap que je dois sauvegarder dans un fichier du même type. pour ensuite l'encrypter dans une librairie protégé. Là le problème est que je dois sauvegarder le bitmap en fichier et hje suis pas capable, j'utilise la fonction SAVE de BITMAP mais christ ca marche pâs, et pourtant je fourni le bon argument, SVP je suis a bout là!
Ça c'est le code que j'ai lorsque je drop un fichier dans mon application
Private Sub ListView1_DragDrop(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles ListView1.DragDrop
Dim cnn As New OleDbConnection(CONST_CONNECTION_STRING)
Dim cmm As New OleDbCommand
Dim newms As MemoryStream
Dim img As Image
Dim sFile() As String
Dim itm As New ListViewItem
Dim index As Integer = ImageList2.Images.Count
Dim i, id As Integer
Dim sLib, sFilename As String
Try
If e.Data.GetDataPresent(DataFormats.FileDrop) Then ' Image File being
dropped
sFile = e.Data.GetData(DataFormats.FileDrop)
pBar.Visible = True
pBar.Minimum = 1
pBar.Maximum = sFile.Length
pBar.Value = 1
pBar.Step = 1
For i = 0 To sFile.Length - 1
' vérifie s'il s'agit d'une fichier d'image
Dim ImgTest As Image = Image.FromFile(sFile(i))
ImgTest = Nothing
' appele la function qui ajoute l'image
addImage(sFile(i))
pBar.PerformStep()
Application.DoEvents()
Next
ElseIf e.Data.GetDataPresent(DataFormats.Dib) Then ' Image dragged from
Corel Designer
Public Sub HandleDropOrPaste(ByRef data As DataObject)
' --- CF_BITMAP test ---
' This line uses the CF_BITMAP data to create a bitmap object directly...
' _bmp = data.GetData(DataFormats.Bitmap)
' --- CF_DIB test ---
' From here we need to create a Bitmap object from the MemoryStream that
contains the CF_DIB data
' But we also need to prepend the data with a BITMAPFILEHEADER
' This pulls the bitmap data from the clipboard. It does not contain a
BITMAPFILEHEADER...
Dim stm As MemoryStream = data.GetData(DataFormats.Dib)
If stm Is Nothing Then
Return
End If
' Read the data from the stream above into a Byte array...
Dim bytes(stm.Length) As Byte
Dim i As Integer
i = stm.Read(bytes, 0, stm.Length)
stm.Close()
If i = 0 Then
Return
End If
' Setup a BITMAPFILEHEADER which we need before the clipboard data...
Dim bmf As New BITMAPFILEHEADER
bmf.bfType = UInt16.Parse(&H4D42)
bmf.bfSize = UInt32.Parse(BMFSIZE + i)
bmf.bfReserved1 = UInt16.Parse(0)
bmf.bfReserved2 = UInt16.Parse(0)
bmf.bfOffBits = UInt32.Parse(BMFSIZE + BMIHSIZE)
' Create a new stream (newstm) which we will fill with all the data we
need...
Dim newstm As New MemoryStream(BMFSIZE + i)
If newstm Is Nothing Then
Return
End If
' Put the BITMAPFILEHEADER (which we initialized above) into newstm...
Dim bmfPtr As New IntPtr
bmfPtr = Marshal.AllocHGlobal(BMFSIZE)
Marshal.StructureToPtr(bmf, bmfPtr, True)
Dim bmfBytes(BMFSIZE) As Byte
Marshal.Copy(bmfPtr, bmfBytes, 0, BMFSIZE)
newstm.Write(bmfBytes, 0, BMFSIZE)
Marshal.FreeHGlobal(bmfPtr)
' Put the data we copied from the clipboard into newstm following
BITMAPFILEHEADER...
newstm.Write(bytes, 0, i)
' Finally, create a new bitmap using the assembled stream...
If newstm.Length > 0 Then
_bmp = New Bitmap(newstm)
End If
' Cleanup and force a redraw...
newstm.Close()
'Me.Invalidate()
End Sub
End Module
"Christian Hugoud" <c2h_nospam@couriel.biz> wrote in message
news:O815ZDF9FHA.4008@TK2MSFTNGP10.phx.gbl...
Mets un bout du code que nous puissions t'aider.
Christian
"Jean Christophe Avard" <NO.SP@M.BITCH> a écrit dans le message de news:
u9vAjAF9FHA.600@tk2msftngp13.phx.gbl...
Là tabarnack je suis à près perdre patience calise. J'ai un objet bitmap
que je dois sauvegarder dans un fichier du même type. pour ensuite
l'encrypter dans une librairie protégé. Là le problème est que je dois
sauvegarder le bitmap en fichier et hje suis pas capable, j'utilise la
fonction SAVE de BITMAP mais christ ca marche pâs, et pourtant je fourni
le bon argument, SVP je suis a bout là!
Public Sub HandleDropOrPaste(ByRef data As DataObject)
' --- CF_BITMAP test ---
' This line uses the CF_BITMAP data to create a bitmap object directly...
' _bmp = data.GetData(DataFormats.Bitmap)
' --- CF_DIB test ---
' From here we need to create a Bitmap object from the MemoryStream that contains the CF_DIB data
' But we also need to prepend the data with a BITMAPFILEHEADER
' This pulls the bitmap data from the clipboard. It does not contain a BITMAPFILEHEADER...
Dim stm As MemoryStream = data.GetData(DataFormats.Dib)
If stm Is Nothing Then
Return
End If
' Read the data from the stream above into a Byte array...
Dim bytes(stm.Length) As Byte
Dim i As Integer
i = stm.Read(bytes, 0, stm.Length)
stm.Close()
If i = 0 Then
Return
End If
' Setup a BITMAPFILEHEADER which we need before the clipboard data...
Dim bmf As New BITMAPFILEHEADER
bmf.bfType = UInt16.Parse(&H4D42)
bmf.bfSize = UInt32.Parse(BMFSIZE + i)
bmf.bfReserved1 = UInt16.Parse(0)
bmf.bfReserved2 = UInt16.Parse(0)
bmf.bfOffBits = UInt32.Parse(BMFSIZE + BMIHSIZE)
' Create a new stream (newstm) which we will fill with all the data we need...
Dim newstm As New MemoryStream(BMFSIZE + i)
If newstm Is Nothing Then
Return
End If
' Put the BITMAPFILEHEADER (which we initialized above) into newstm...
Dim bmfPtr As New IntPtr
bmfPtr = Marshal.AllocHGlobal(BMFSIZE)
Marshal.StructureToPtr(bmf, bmfPtr, True)
Dim bmfBytes(BMFSIZE) As Byte
Marshal.Copy(bmfPtr, bmfBytes, 0, BMFSIZE)
newstm.Write(bmfBytes, 0, BMFSIZE)
Marshal.FreeHGlobal(bmfPtr)
' Put the data we copied from the clipboard into newstm following BITMAPFILEHEADER...
newstm.Write(bytes, 0, i)
' Finally, create a new bitmap using the assembled stream...
If newstm.Length > 0 Then
_bmp = New Bitmap(newstm)
End If
' Cleanup and force a redraw...
newstm.Close()
'Me.Invalidate()
End Sub
End Module
"Christian Hugoud" wrote in message news:
Mets un bout du code que nous puissions t'aider.
Christian
"Jean Christophe Avard" a écrit dans le message de news:
Là tabarnack je suis à près perdre patience calise. J'ai un objet bitmap que je dois sauvegarder dans un fichier du même type. pour ensuite l'encrypter dans une librairie protégé. Là le problème est que je dois sauvegarder le bitmap en fichier et hje suis pas capable, j'utilise la fonction SAVE de BITMAP mais christ ca marche pâs, et pourtant je fourni le bon argument, SVP je suis a bout là!
Jacques93
Bonjour Jean Christophe Avard, Jean Christophe Avard a écrit :
Là tabarnack je suis à près perdre patience calise. J'ai un objet bitmap que je dois sauvegarder dans un fichier du même type. pour ensuite l'encrypter dans une librairie protégé. Là le problème est que je dois sauvegarder le bitmap en fichier et hje suis pas capable, j'utilise la fonction SAVE de BITMAP mais christ ca marche pâs, et pourtant je fourni le bon argument, SVP je suis a bout là!
Tabarnack, t'es pas sur le bon forum là, va plutôt voir sur :
microsoft.public.fr.dotnet.vb
-- Cordialement,
Jacques.
Bonjour Jean Christophe Avard,
Jean Christophe Avard a écrit :
Là tabarnack je suis à près perdre patience calise. J'ai un objet bitmap que
je dois sauvegarder dans un fichier du même type. pour ensuite l'encrypter
dans une librairie protégé. Là le problème est que je dois sauvegarder le
bitmap en fichier et hje suis pas capable, j'utilise la fonction SAVE de
BITMAP mais christ ca marche pâs, et pourtant je fourni le bon argument, SVP
je suis a bout là!
Tabarnack, t'es pas sur le bon forum là, va plutôt voir sur :
Bonjour Jean Christophe Avard, Jean Christophe Avard a écrit :
Là tabarnack je suis à près perdre patience calise. J'ai un objet bitmap que je dois sauvegarder dans un fichier du même type. pour ensuite l'encrypter dans une librairie protégé. Là le problème est que je dois sauvegarder le bitmap en fichier et hje suis pas capable, j'utilise la fonction SAVE de BITMAP mais christ ca marche pâs, et pourtant je fourni le bon argument, SVP je suis a bout là!
Tabarnack, t'es pas sur le bon forum là, va plutôt voir sur :
microsoft.public.fr.dotnet.vb
-- Cordialement,
Jacques.
Jean Christophe Avard
hahah merci, j'étais faché ... "Jacques93" wrote in message news:O8c%
Bonjour Jean Christophe Avard, Jean Christophe Avard a écrit :
Là tabarnack je suis à près perdre patience calise. J'ai un objet bitmap que je dois sauvegarder dans un fichier du même type. pour ensuite l'encrypter dans une librairie protégé. Là le problème est que je dois sauvegarder le bitmap en fichier et hje suis pas capable, j'utilise la fonction SAVE de BITMAP mais christ ca marche pâs, et pourtant je fourni le bon argument, SVP je suis a bout là!
Tabarnack, t'es pas sur le bon forum là, va plutôt voir sur :
microsoft.public.fr.dotnet.vb
-- Cordialement,
Jacques.
hahah merci, j'étais faché ...
"Jacques93" <jacques@NoSpam> wrote in message
news:O8c%23ecF9FHA.1248@TK2MSFTNGP14.phx.gbl...
Bonjour Jean Christophe Avard,
Jean Christophe Avard a écrit :
Là tabarnack je suis à près perdre patience calise. J'ai un objet bitmap
que je dois sauvegarder dans un fichier du même type. pour ensuite
l'encrypter dans une librairie protégé. Là le problème est que je dois
sauvegarder le bitmap en fichier et hje suis pas capable, j'utilise la
fonction SAVE de BITMAP mais christ ca marche pâs, et pourtant je fourni
le bon argument, SVP je suis a bout là!
Tabarnack, t'es pas sur le bon forum là, va plutôt voir sur :
hahah merci, j'étais faché ... "Jacques93" wrote in message news:O8c%
Bonjour Jean Christophe Avard, Jean Christophe Avard a écrit :
Là tabarnack je suis à près perdre patience calise. J'ai un objet bitmap que je dois sauvegarder dans un fichier du même type. pour ensuite l'encrypter dans une librairie protégé. Là le problème est que je dois sauvegarder le bitmap en fichier et hje suis pas capable, j'utilise la fonction SAVE de BITMAP mais christ ca marche pâs, et pourtant je fourni le bon argument, SVP je suis a bout là!
Tabarnack, t'es pas sur le bon forum là, va plutôt voir sur :