1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Copying Image to Clipboard

Discussion in 'Visual Basic 6' started by teguh123, Oct 11, 2009.

  1. teguh123

    teguh123 BANNED BANNED Premium Member

    Joined:
    Sep 23, 2008
    Messages:
    703
    Likes Received:
    105
    Hi,

    if I have a htmlimg object and I want to copy that to clipboard or to file how do I do that?

    This is my code

    Code:
    Public Function imgToFile(img As HTMLImg) As String
        Dim ocr As IHTMLControlRange
        Dim theFile As String
        
        theFile = trim(CStr((GetTickCount Mod 100000))) + ".jpg"
        
        
        Set ocr = img.Document.body.createControlRange
        Clipboard.Clear
        ocr.Add img
        ocr.execCommand "Copy"
        Call SavePicture(Clipboard.GetData(ClipBoardConstants.vbCFBitmap), theFile)
        imgToFile = theFile
    End Function
    
     
  2. sheppardzwc

    sheppardzwc Newbie

    Joined:
    Oct 21, 2010
    Messages:
    15
    Likes Received:
    0
    well you're banned, so I guess I can't help :p