Private Sub Command1_Click() SaveMixedFile App.Path & "\out", Text1.Text, Picture1.Picture End Sub Public Sub SaveMixedFile(ByVal File As String, ByVal Str As String, ByVal Pic As IPictureDisp) Screen.MousePointer = vbHourglass SavePicture Pic, File & ".tmp.bmp" Dim CPic As Byte, CMixed As Byte CMixed = FreeFile: Open File For Binary Access Write As CMixed CPic = FreeFile: Open File & ".tmp.bmp" For Binary Access Read As CPic Put #CMixed, , CDbl(Len(Str)) Put #CMixed, , Str Dim Buffer() As String * 1 ReDim Buffer(FileLen(File & ".tmp.bmp")) Get #CPic, , Buffer: Close CPic Put #CMixed, , Buffer: Close CMixed Kill File & ".tmp.bmp" Screen.MousePointer = vbDefault End Sub Public Function LoadMixedFile(ByVal File As String, ByRef Str As String) As IPictureDisp Screen.MousePointer = vbHourglass Dim CPic As Byte, CMixed As Byte CMixed = FreeFile: Open File For Binary Access Read As CMixed CPic = FreeFile: Open File & ".tmp.bmp" For Binary Access Write As CPic Dim ReadBuffer As String * 1 Dim Length As Double Dim Buffer() As String * 1 Get #CMixed, , Length Dim i As Double Str = vbNullString For i = 0 To Length - 1 Get #CMixed, , ReadBuffer Str = Str & ReadBuffer Next i ReDim Buffer(LOF(CMixed) - Seek(CMixed)) Get #CMixed, , Buffer Put #CPic, , Buffer Close CPic Close CMixed Set LoadMixedFile = LoadPicture(File & ".tmp.bmp") Kill File & ".tmp.bmp" Screen.MousePointer = vbDefault End Function Private Sub Command2_Click() Dim Str As String Set Picture2.Picture = LoadMixedFile(App.Path & "\out", Str) Text2.Text = Str End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub Command1_Click() SaveMixedFile App.Path & "\out", Text1.Text, Text2.Text , Picture1.Picture End Sub Public Sub SaveMixedFile(ByVal File As String, ByVal Str1 As String, byval Str2 as String , ByVal Pic As IPictureDisp) Screen.MousePointer = vbHourglass SavePicture Pic, File & ".tmp.bmp" Dim CPic As Byte, CMixed As Byte CMixed = FreeFile: Open File For Binary Access Write As CMixed CPic = FreeFile: Open File & ".tmp.bmp" For Binary Access Read As CPic Put #CMixed, , CDbl(Len(Str1)) Put #CMixed, , Str1 Put #CMixed, , CDbl(Len(Str2)) Put #CMixed, , Str2 Dim Buffer() As String * 1 ReDim Buffer(FileLen(File & ".tmp.bmp")) Get #CPic, , Buffer: Close CPic Put #CMixed, , Buffer: Close CMixed Kill File & ".tmp.bmp" Screen.MousePointer = vbDefault End Sub Public Function LoadMixedFile(ByVal File As String, ByRef Str1 As String, Byref Str2 as string) As IPictureDisp Screen.MousePointer = vbHourglass Dim CPic As Byte, CMixed As Byte CMixed = FreeFile: Open File For Binary Access Read As CMixed CPic = FreeFile: Open File & ".tmp.bmp" For Binary Access Write As CPic Dim ReadBuffer As String * 1 Dim Length As Double Dim Buffer() As String * 1 Get #CMixed, , Length Dim i As Double Str1 = vbNullString For i = 0 To Length - 1 Get #CMixed, , ReadBuffer Str1 = Str1 & ReadBuffer Next i Get #CMixed, , Length Str2 = vbNullString For i = 0 To Length - 1 Get #CMixed, , ReadBuffer Str2 = Str2 & ReadBuffer Next i ReDim Buffer(LOF(CMixed) - Seek(CMixed)) Get #CMixed, , Buffer Put #CPic, , Buffer Close CPic Close CMixed Set LoadMixedFile = LoadPicture(File & ".tmp.bmp") Kill File & ".tmp.bmp" Screen.MousePointer = vbDefault End Function Private Sub Command2_Click() Dim Str1 As String , Str2 as String Set Picture2.Picture = LoadMixedFile(App.Path & "\out", Str1 , Str2) Text3.Text = Str1 Text4.Text = Str2 End Sub