Twain to Picture Object?

Discussions about image processing and document imaging.
Post Reply
BPinkerton
Posts: 5
Joined: Sat May 26, 2007 9:14 pm

Twain to Picture Object?

Post by BPinkerton » Sun May 27, 2007 12:32 am

:?:
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?

:roll:

BPinkerton
Posts: 5
Joined: Sat May 26, 2007 9:14 pm

Where am I?

Post by BPinkerton » Sun May 27, 2007 12:57 am

Have made 2 recent posts, hope I am using the correct forum.
I have version gdPicturepro.ocx from Jan. 2007

:!:

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Post by Loïc » Tue May 29, 2007 11:05 am

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:

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

BPinkerton
Posts: 5
Joined: Sat May 26, 2007 9:14 pm

Twain Solution

Post 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.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest