473,387 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

DigitalPersona SDK C# code

In case anyone is wondering...

(this is based on a conversation with "Juan C. Santaella"
<sa******@telcel.net.ve>,
I'm sharing here so anyone won't have to go through what I went through
again)

To display the DigitalPersona sample in a .NET Windows Forms PictureBox
:

Anyways, I found an alternative way that doesn't use
VisualBasic.Compatibility. It turns out the Picture is a standard
IPicture OLE object supported by the legacy Platform SDK. I can draw
the picture to anything in .NET that has a HDC handle. In this case I
use a .NET PictureBox to contain the picture :

private void axFPGetSampleX1_Done_1(object sender,
AxDPSDKOPSLib._IFPGetSampleXEvents_DoneEvent e)
{
IFPSample sample = (IFPSample)e.pSample;
IPicture picture = (IPicture)sample.Picture;
textBox1.Text = picture.Width.ToString() + "-" +
picture.Height.ToString();
using (Graphics graphics = pictureBox1.CreateGraphics())
{
IntPtr hDc = graphics.GetHdc();
picture.Render(hDc.ToInt32(), 0, 0, pictureBox1.Width,
pictureBox1.Height,
0, 0, picture.Width, picture.Height, IntPtr.Zero);
}
}

It worked for the moment. Maybe it's not very correct as it uses the
PictureBox's Graphics/DeviceContext instead of the Image's
(PictureBox.Image) Graphics/DeviceContext. But anyway it works so I
can save it to a GIF, BMP, JPEG, or save it to database if I want to.
And it works universally (meaning you can use it with C#, J#, or any
other .NET language). Not that you have to add a reference to stdole
COM library (that should be automatic). IPicture is contained in the
stdole namespace.

I'm not sure if you need any of this info. Maybe I'll post this
somewhere on google groups or forums so that more people will be able
to use DigitalPersona and not trying to bash their heads off in a
wall. (which may lead to more competition, but no good deed goes
unpunished).
--
Hendy Irawan
Web: http://www.gauldong.net
Mobile: +62 856 24889899
Yahoo Messenger: ceefour666

Sep 20 '06 #1
2 9760
I am curious, why the aversion to using the helper function in the
Microsoft.VisualBasic.Compatability namespace?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ceefour" <ga******@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
In case anyone is wondering...

(this is based on a conversation with "Juan C. Santaella"
<sa******@telcel.net.ve>,
I'm sharing here so anyone won't have to go through what I went through
again)

To display the DigitalPersona sample in a .NET Windows Forms PictureBox
:

Anyways, I found an alternative way that doesn't use
VisualBasic.Compatibility. It turns out the Picture is a standard
IPicture OLE object supported by the legacy Platform SDK. I can draw
the picture to anything in .NET that has a HDC handle. In this case I
use a .NET PictureBox to contain the picture :

private void axFPGetSampleX1_Done_1(object sender,
AxDPSDKOPSLib._IFPGetSampleXEvents_DoneEvent e)
{
IFPSample sample = (IFPSample)e.pSample;
IPicture picture = (IPicture)sample.Picture;
textBox1.Text = picture.Width.ToString() + "-" +
picture.Height.ToString();
using (Graphics graphics = pictureBox1.CreateGraphics())
{
IntPtr hDc = graphics.GetHdc();
picture.Render(hDc.ToInt32(), 0, 0, pictureBox1.Width,
pictureBox1.Height,
0, 0, picture.Width, picture.Height, IntPtr.Zero);
}
}

It worked for the moment. Maybe it's not very correct as it uses the
PictureBox's Graphics/DeviceContext instead of the Image's
(PictureBox.Image) Graphics/DeviceContext. But anyway it works so I
can save it to a GIF, BMP, JPEG, or save it to database if I want to.
And it works universally (meaning you can use it with C#, J#, or any
other .NET language). Not that you have to add a reference to stdole
COM library (that should be automatic). IPicture is contained in the
stdole namespace.

I'm not sure if you need any of this info. Maybe I'll post this
somewhere on google groups or forums so that more people will be able
to use DigitalPersona and not trying to bash their heads off in a
wall. (which may lead to more competition, but no good deed goes
unpunished).
--
Hendy Irawan
Web: http://www.gauldong.net
Mobile: +62 856 24889899
Yahoo Messenger: ceefour666

Sep 20 '06 #2
Nicholas Paldino [.NET/C# MVP] wrote:
I am curious, why the aversion to using the helper function in the
Microsoft.VisualBasic.Compatability namespace?
I'm not sure. Maybe I personally like the more "general" way of doing
things.

- VisualBasic.Compatibility is easier to use (good)
- The VisualBasic.Compatibility way is too specific. Well it works for
converting the IPicture to a .NET Image. But maybe you want to inspect
the IPicture directly. Or maybe you're not working with IPicture, but
any other interface supported by Windows OLE/COM, etc. (not specific to
this DigitalPersona case)
- I'm not sure, but I can't find VisualBasic.Compatibility in my VS
2005 documentation (though the .dll assembly exists)
- It requires additional reference to VisualBasic.Compatibility
assembly. Not really a minus, though. Using IPicture would just mean we
need a reference to stdole COM dll, which is probably a requirement
anyway if you do interop with most COM dlls.
- I'm also not sure, but I think VisualBasic.Compatibility ultimately
uses stdole, since it will need access to IPicture anyway.

I'd say my conclusion is that VisualBasic.Compatibility is more
high-level and IPicture is rather low-level.

What I hate about DigitalPersona's API is that they don't just return
IPicture type, but instead they return IDispatch, which is quite
confusing at first, since you have to cast it to IPicture. I'm not sure
but is this on purpose or because COM has no way of using types from
other type libraries? (for example, DigitalPersona returns IPicture
which is defined in stdole?) This also happens with also every other
thing returned, FPSample returned as IDispatch, FPTemplate returned as
IDispatch, etc. Good thing I got the Developer's Guide now, so I know
which things is using what type. It's not like it has a
EnumerateSupportedInterfaces() method. :-(

Sep 22 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

51
by: Mudge | last post by:
Please, someone, tell me why OO in PHP is better than procedural.
109
by: Andrew Thompson | last post by:
It seems most people get there JS off web sites, which is entirely logical. But it is also a great pity since most of that code is of such poor quality. I was looking through the JS FAQ for any...
0
by: Namratha Shah \(Nasha\) | last post by:
Hey Guys, Today we are going to look at Code Access Security. Code access security is a feature of .NET that manages code depending on its trust level. If the CLS trusts the code enough to...
171
by: tshad | last post by:
I am just trying to decide whether to split my code and uses code behind. I did it with one of my pages and found it was quite a bit of trouble. I know that most people (and books and articles)...
4
by: KenFehling | last post by:
Hello. I am wondering if there exists a piece of software that takes multiple .js files that are nicely indented and commented and create one big tightly packed .js file. I'm hoping the one file...
88
by: Peter Olcott | last post by:
Cab you write code directly in the Common Intermediate language? I need to optimize a critical real-time function.
7
by: blackrosezy | last post by:
#include char *code; void main() { char buf = "book";
5
by: Juan C. Santaella | last post by:
Hi!! I wonder if any of you has worked with the DigitalPersona Platinum SDK. I have to start a C# application that integrates the u.are.u 4000B fingerprint reader using the SDK. Any help or...
2
by: rn5a | last post by:
Assume that a user control (MyUC.ascx) encapsulates 2 TextBoxes with the IDs 'txt1' & 'txt2' respectively. To use this user control in an ASPX page, the following Register directive will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.