by BPinkerton » Wed May 30, 2007 2:10 pm
Hi loic,
Thank you for the responses to my questions.
This is the code I had used to copy any image to the clipboard:
Call oGdPicture.CopyToClipboard
Using the various sample codes and your response, I have continued messing here and finally have a solution that obtains the twain image and at completion, that image is then available to the clipboard, a VB6 picture control and all gdPicture Effects & other functions immediately, as thought it were obtained as loadfile, etc.
Not "great" code but it does what I need and possibly others can use/improve it.
Private Sub Get_Twain()
picPreview.Cls
oGdViewer.closePicture
oGdViewer.ZoomMode = 2
Call oGdPicture.TwainOpenDefaultSource
Call oGdPicture.TwainSetHideUI(True)
Call oGdPicture.TwainAcquire
Call oGdPicture.TwainCloseSource
If oGdPicture.GetStat = 0 Then
nNativeImageHandle = oGdPicture.GetNativeImage()
nPreviewHandle = oGdPicture.MakeThumbnail(picPreview.Width, picPreview.Height)
Call oGdPicture.SetNativeImage(nPreviewHandle)
Call oGdPicture.DisplayImageOnHDC(picPreview.hDC, 0, 0, picPreview.ScaleWidth, picPreview.ScaleHeight)
Call oGdPicture.CloseImage(nPreviewHandle)
picPreview.Refresh
Call oGdPicture.SetNativeImage(nNativeImageHandle)
oGdViewer.DisplayFromImageRef (nNativeImageHandle)
End If
Image1.Picture = oGdPicture.GetPicture
Picture1.Picture = oGdPicture.GetPicture
End Sub
Regards.