List Info

Thread: C-Sharp (C#) Group: Re: Receiving TWAIN images




C-Sharp (C#) Group: Re: Receiving TWAIN images
user name
2006-10-17 17:03:59
Mmkay, it compiled, using your first example and the
DibToImage class
you posted.  But I'm still not getting anything through into
the
picture box, and I'm not sure how to troubleshoot in
between.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharpgooglegroups.com
To unsubscribe from this group, send email to
C_Sharp-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups-beta.google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---

C-Sharp (C#) Group: Re: Receiving TWAIN images
user name
2006-10-17 18:48:41
Mmkay; I tested with changing the text of a label, and the
segment of
code isn't even getting executed.  That would explain it!

Here's the context of the full function.  I don't understand
the event
to begin with, so I'm stuck as to how to get the switch for
TransferReady to execute:

bool IMessageFilter.PreFilterMessage(ref Message m)
        {
            TwainCommand cmd = incoming.PassMessage(ref m);
            if (cmd == TwainCommand.Not)
                return false;

            switch (cmd)
            {
                case TwainCommand.CloseRequest:
                    {
                        EndingScan();
                        incoming.CloseSrc();
                        break;
                    }
                case TwainCommand.CloseOk:
                    {
                        EndingScan();
                        incoming.CloseSrc();
                        break;
                    }
                case TwainCommand.DeviceEvent:
                    {
                        break;
                    }
                case TwainCommand.TransferReady:
                    {
                        lblStatus.Text = "Receiving
Data...";
                        ArrayList pics =
incoming.TransferPictures();
                        EndingScan();
                        incoming.CloseSrc();
                        picnumber++;
                        for (int i = 0; i < pics.Count;
i++)
                        {
                            IntPtr img = (IntPtr)pics[i];
                            IntPtr bmpptr = PicForm
.GlobalLock(img);
                            Bitmap b =
DibToImage.WithStream(bmpptr);
                            //IntPtr bmpptr =
PicForm.GlobalLock( img
);
		                    //IntPtr pixptr =
PicForm.GetPixelInfo( bmpptr );
                            //Bitmap b =
Gdip.GdipCreateBitmapFromGdiDib(bmpptr, pixptr);
                            //Gdip.GlobalFree(bmpptr);
                            pbSample.Image = b;


                        }
                        break;
                    }
            }

            return true;
        }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharpgooglegroups.com
To unsubscribe from this group, send email to
C_Sharp-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups-beta.google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )