Twain to Picture Object?
-
- Posts: 5
- Joined: Sat May 26, 2007 9:14 pm
Twain to Picture Object?
I am trying to scan images. I can do this Ok with the supplied example code and the resultant image is displayed properly, but, I cannot then copy the image either to the clipboard OR to a Picture control on the same form.
A.K.A., I can see it but can't manipulate it much, if any!
What to do for these 2 problems?
-
- Posts: 5
- Joined: Sat May 26, 2007 9:14 pm
Where am I?
Have made 2 recent posts, hope I am using the correct forum.
I have version gdPicturepro.ocx from Jan. 2007
I have version gdPicturepro.ocx from Jan. 2007
Hi,
What is the code you are using to copy the image to le clipboard ?
To acquire with vb6 and copy the image to the clipboard:
Regards,
Loïc
What is the code you are using to copy the image to le clipboard ?
To acquire with vb6 and copy the image to the clipboard:
Code: Select all
Dim oGdPicture As New GdpicturePro.cGdPicture
Dim nImageID As Long
oGdPicture.TwainOpenDefaultSource
nImageID = oGdPicture.CreateImageFromTwain(Me.hWnd)
If nImageID <> 0 Then oGdPicture.CopyToClipboard
oGdPicture.TwainCloseSource
Regards,
Loïc
-
- Posts: 5
- Joined: Sat May 26, 2007 9:14 pm
Twain Solution
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.
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.
Who is online
Users browsing this forum: No registered users and 1 guest