|
hi,
how to use "Visual Brush" to magnifying the specified area.
thanx
your
peter
|
|
|
|
|
|
Hi guys,
So I'm trying to code a sample application for a fingerprint scanner that I recently bought from supremainc.com. Now the sample they provided alongwith is in VB6. I've been successfully able to convert most of the code to VB.NET. The part upto capturing an image is working fine. But when it comes to verification, the old VB6 code uses the VarPtr function - which isn't there in .NET anymore.
Now testing the sample application won't be possible for any of you - coz you'd need the actual device to get it working. But still I'm including the code for both VB6 and .NET here - at least looking at it might help.
Searching for a VarPtr replacement, I came across this code from PlanetSourceCode
===========================================================================
Public Function VarPtr(ByVal o As Object) As Integer
Dim GC As System.Runtime.InteropServices.GCHandle = _
System.Runtime.InteropServices.GCHandle.Alloc _
(o, System.Runtime.InteropServices.GCHandleType.Pinned)
Dim ret As Integer = GC.AddrOfPinnedObject.ToInt32
GC.Free()
Return ret
End Function
===========================================================================
The VB6 code contains this segment:
===========================================================================
Private EnrollTemplate(383, 9) As Byte
.......
.....
Dim Buffer(9) As Long
............
For i = 0 To 9
Buffer(i) = VarPtr(EnrollTemplate(0, i))
Next i
===========================================================================
So I used that in my VB.NET application - and am calling the routine this way:
===========================================================================
Private EnrollTemplate(383, NUM_RECORDS) As Byte
............
Dim Buffer(10) As Integer
...............
For Counter As Integer = 0 To NUM_RECORDS - 1
Buffer(Counter) = VarPtr(CType(EnrollTemplate(0, Counter), Object))
Next
===========================================================================
But it doesn't seem to have the same effect - so my verification is failing.
Also as per the discussion in this thread: http://www.vbcity.com/forums/topic.asp?tid=121051 I've converted the Long variables in the VB6 code to Integer for VB.NET. The code samples (full) I'm talking about can be found attached to the vbCity thread, as the posts here don't permit attachments.
Please find both versions of the project included as .zip attachments. Kindly take a look at them and see if any of you can spot what's going wrong. I know it's difficult to do so - without the code actually running.. but still.
In case you want to look into the Scanner SDK API calls, I'm including the API documentation too in form of a .PDF file.
Any help will be greatly appreciated. Please check out the discussion in the vbCity thread first and go through the code files.
Best Regards & Thanks,
kil0byte^bandit
PeoPLe aRe cRazY anD tiMeS aRe sTRaNGe, i'M LoCKeD iN tiGhT, i'M OuT oF raNGe, i uSeD t0 caRe BuT - thiNGs haVe chaNGeD.
-- modified at 0:21 Sunday 19th February, 2006
|
|
|
|
|
Hi Guys!! Im trying to Make a Bittorrent Client in VB.Net 2005. I want to run the main form of my Project on a Thread and for that i have started my Project with a Module. The Module calls the Form in its Main() function.
What i wanted to do was to create a thread an load the main form in this Thread so that my Main Form runs in the Background. How do i achieve this. The Following code doesnt seem to work:
Dim myThread as new Thread(new ThreadStart(AddressOf MainForm.Load))
myThread.Start()
The Error is that i cannot call the load event inside ThreadStart. So i Dont know what to write after 'AddressOf' so that my Main Form gets Loaded and it runs when the myThread.Start() method is Called.
If anybody know what to do, Plz write back to me. Thank You!!
Devraj Raut!!!
|
|
|
|
|
Devraj Raut wrote: The Error is that i cannot call the load event inside ThreadStart.
You're supposed to pass it a method. An event is not a method.
Also, I don't think it's a good idea to launch a form on a different thread. Forms and their controls are not thread safe and are not supposed to interact with other forms/controls/etc. on a separate thread.
Instead, I recommend that you run your bittorrent code on a different thread. If you want it to update your form, then you should look into using BeginInvoke() to do this in a thread safe manner.
http://www.codeproject.com/csharp/begininvoke.asp[^]
|
|
|
|
|
Hi!
How can i catch a filename that was passed to my application?
for ex. I added a shell registry entry so that everytime i right click a file it opens it in my application. The registrykey is this "myApplicationPath %1" so that the file gets oppened with my application and the filename is passed along.
Now how do i catch that passed filename in my application??
Thanx
|
|
|
|
|
The file name will be passed into the 1st command line argument. You can access these command line arguments in your main function.
Shared Sub Main(ByVal args() As String)
Dim sFileName As String = String.Empty
If (args.Length >= 1) Then
sFileName = args(0)
End If
End Sub
|
|
|
|
|
thanks Joshua, i tried but i'm still in the dark here
i don't know how to use your code really...
my application is a windows app with forms, I tried putting it in form_load, but..then i tried making a new sub, but..
i'm still in my learning curve in vb.net so can you be more specific, please
thanks
|
|
|
|
|
The code I gave you assumes that your project's Startup object is set to "Sub Main". Your startup object is obviously set to your form. You can access the command line arguments in your form if you want via System.Environment.CommandLine, but this give you just 1 string and you would have to parse it out yourself.
I think switching to a Sub Main would be better. You would set this up by doing the following:
1) Go to the Solution Explorer panel.
2) Right click on your project file in the tree.
3) Select Properties on the context menu.
4) Select CommonProperties\General on the tree on the left.
5) Select "Sub Main" in the Startup Object ComboBox.
6) Click OK.
7) Add a Main function somewhere in your code. I like to put mine in a Main.vb class file. The main code should look something like this...
Public Class Main
Public Shared Sub Main(ByVal args() As String)
' Get file name to open from the command line.
Dim sFileName As String = String.Empty
If (args.Length > 0) Then
sFileName = args(0)
End If
' Do something...
' Display your main form with XP theme.
Application.EnableVisualStyles()
Application.DoEvents()
Application.Run(New YourMainForm)
End Sub
End Class
|
|
|
|
|
it works!!!
i had a little trouble setting up the Startup Object to Sub Main in vs2005 but now it works
Thank you VERY much
if you don't mind i have an other question..
are there any benefits to starting your app with Sub Main rather than directly with a form (assuming you dont need to catch any passed data of course )
|
|
|
|
|
Pruck wrote: i had a little trouble setting up the Startup Object to Sub Main in vs2005 but now it works
The instructions I gave you were for VS 2003. Sorry about the mixup. I'm glad you got it working.
Pruck wrote: are there any benefits to starting your app with Sub Main rather than directly with a form
Here's some advantages. I'm sure there are others:
- Catching command line arguments of course.
- Enabling VisualStyles for WinXP theme support. Must be done before showing your form.
- Good place to check if an app instance is already running. Although VB2005 gives this to you for free now.
- Good place to do startup validation before showing a heavy form that takes a while to load up.
|
|
|
|
|
Thanks! I appreciate your help.
and now that my curiosity has been satisfied i can finally get myself same sleep
|
|
|
|
|
Hi, Microsoft ISA 2004 has the possibility to control the user that access to the internet and display the result of information relate to user activity and internet usage of specific user.
From here, i have an idea. I have a server and i want to write my own application that could control the session of the user that connect to the internet through the server. First, i want to log the session of user which access to the internet through the server in a text file. Then i want to write my own vb.net application which transfter those information into SQL server and generate a report. Does anyone have an idea, website resource or sample to do it?
|
|
|
|
|
Roath Kanel wrote: anyone have an idea, website resource or sample to do it?
This is essentially a internet proxy server. All requests, and responses, will go through your proxy. You can do what ever you want with them.
This will not be an easy project to tackle. You'll be heavily using the sockets classes and threading. You'll be writing both an HTTP Server and a client in one application. There isn't going to be any one site describing how to do this.
Start with simple sockets chat applications and work your way up. Write a Telnet client after that, then a simple Telnet server. You'll want to move up to multi-threading servers after that. A proxy server will be a glorified extension of both the Telnet client and multi-threaded server.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave, thank you very much for your information.
Dave Kreskowiak wrote: Start with simple sockets chat applications and work your way up. Write a Telnet client after that, then a simple Telnet server. You'll want to move up to multi-threading servers after that. A proxy server will be a glorified extension of both the Telnet client and multi-threaded server.
Are there any resource for me to read about:
- Programming with socket chat application.
- Programming telnet.
- Multi-threading.
I prefer to learn about this step in order to do my own work.
|
|
|
|
|
|
hi all i want to know that where to place the common variables and access them in all forms in vb.net.
i vb6 there was area known as the sub main. i had made an application as windows form application.
ddd
|
|
|
|
|
tasleem143 wrote: i want to know that where to place the common variables and access them in all forms in vb.net.
Create a module and delcare your viriable as GLOBAL.
|
|
|
|
|
There's no such thing as Global variables in the .NET Framework.
You can have Shared variables in classes though...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Common practice is to place these in a class as Shared variables. But, this goes against accepted OOP practices, so try to keep this to a minimum as you learn true Object Oriented Programming practices.
Public Class Globals
Public Shared GlobalVar As Integer
End Class
You can then access this "global" anywhere in your code, simply by using:
Globals.GlobalVar = 3
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi,
I developed project using WINSCOK CONTROL in VB.Now i'm in need to convert it into VB.NET. I'm trying to upgrade it but i cann't pls help how to upgrade it.
subhulakshmi
|
|
|
|
|
|
It is regarding passing of complex structure consisting of double,structure to an api in vb.net. I have tried marshalling the structure as ptr and sending it to api, but it doesn't works.
could u plz throw light on it.
---Pravin.
|
|
|
|
|
pravinkgarg,
Without seeing any of your real code,
I'd guess it needs to look something like this:
Imports System.Runtime.InteropServices
Public Class Form1
Inherits System.Windows.Forms.Form
"<Windows Form Designer generated code Removed>"
Public Declare Auto Function xyz Lib "lib1" (ByRef t1 As IntPtr) As Integer
Private Sub TestMe()
Dim retval As Integer
Dim ctest As New test
'Allocate a block of memory
Dim ctestSize As Int32 = Marshal.SizeOf(ctest)
Dim itest As IntPtr = Marshal.AllocHGlobal(ctestSize)
'Marshal data from a managed object, to an
'unmanaged block of memory
Marshal.StructureToPtr(ctest, itest, False)
'call xyz
retval = xyz(itest)
'Marshal data from a managed object, to an
'unmanaged block of memory
Marshal.StructureToPtr(ctest, itest, False)
'<<<< DO SOMTHING WITH ctest HERE >>>>>
'somthing = ctest.item1
'somthing = ctest.item2
'...ect..
'<<<< BEFORE YOU FREE MEMORY HERE >>>>>>
'Free the block of memory
Marshal.FreeHGlobal(itest)
End Sub
End Class
Public Class test
Public item1 As Integer
Public item2 As New struct2
<VBFixedArray(45)> _
Public item3() As Double
Public Sub New()
item3 = New Double(45) {}
End Sub
End Class
Public Class struct2
'
'<Public whatever is in struct2>
'
Public Sub New()
'<whatever = New of whatever Intializes struct2>
End Sub
End Class
Maybe that will help you out,
progload
|
|
|
|
|
hi every one,
i am using frames concept on my web page. on one of the
frame i am showing a gif image.i have to zoom the "particular" gif image
area where my mouse pointer is pointing.
thanx
your
peter
|
|
|
|