Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21103

[RESOLVED] VB6 SavePicture to save stdPicture

$
0
0
I have a class called Image.cls with Key,FileName,Picture,LoadImage(return Picture by LoadPicture). I want to a SaveAs function, But How to use VB6 SavePicture to save stdPicture? I got an "Permition denied" error. I know I miss use SavePicture Me.Picture, FileName

Code:


Friend Function LoadImage(ByVal FilePath As String)

    If Len(FilePath) = 0 Then Exit Function
    If pvDoesFileExists(FilePath, True) Then
      Set Me.Picture = LoadPicture(FilePath)
    Else
      Set Me.Picture = Nothing
    End If

End Function

Public Property Get Picture() As StdPicture

    Set Picture = m_objPicture

End Property

Public Property Set Picture(ByVal objPicture As StdPicture)

    Set m_objPicture = objPicture

End Property

Public Function SaveAs(ByVal FileName As String, ByVal eFormat As ImageFormat)

Dim hFile As Long

    If Len(FileName) = 0 Then Exit Function
    If Me.Picture.Handle = 0 Then Exit Function
    If pvDoesFileExists(FileName, True) Then
      If pvDeleteTheFile(FileName, True) Then
          hFile = pvCreateTheFile(FileName, False, True)
          If hFile = INVALID_HANDLE_VALUE Or hFile = 0& Then Exit Function
          SavePicture Me.Picture, FileName
      Else
          Exit Function
      End If
    Else
      hFile = pvCreateTheFile(FileName, False, True)
      If hFile = INVALID_HANDLE_VALUE Or hFile = 0& Then Exit Function
      SavePicture Me.Picture, FileName
    End If
   
    CloseHandle hFile
   
End Function


Viewing all articles
Browse latest Browse all 21103

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>