Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
19
Erster Beitrag:
vor 8 Jahren, 2 Monaten
Letzter Beitrag:
vor 8 Jahren, 2 Monaten
Beteiligte Autoren:
cardcoder, Arie, Fabrice Harari, Fabrice Harari.pcs.crosspost

WD10 VB DLL

Startbeitrag von cardcoder am 30.04.2010 13:15

Hi Guys,

I have not needed to use the DLL before. I normally use an activex/ocx.

Is there an easy way to ready the functions of a DLL or is it automatic. Excuse my stupidity but I have had a look at the help - but it was not as helpful as it could be.

If there are any examples about it would be useful.

Many Thanks,

Mike Allison

Antworten:

Hi Mike

- regular dlls, usi the API function
- .net dll/assembly, integrate the assembly and use the resulting classes

best regards


von Fabrice Harari - am 30.04.2010 13:17
Fabrice,

You're well ahead of me.... can you elaborate just a bit. I have never needed to do this - so I am not fully understanding the help.

Is there a way to read the functions of the dll?

Sorry if I sound thick.

Mike Allison

von cardcoder - am 30.04.2010 13:40

Re: WD10 VB DLL

Hi Mike

as I was saying, it depends of the TYPE of the dll. It can be a normal
one or a .net one. And you'll need to get some information about it from
the developers.

Once you know that, you should start by having a look in the help about
either the API or the .net functions...

Best regards


--
Fabrice Harari
Consultant WinDev, WebDev et WinDev Mobile International

Plus d'information sur http://fabriceharari.com/index_FR.html


On 30/04/2010 11:19, Mike Allison wrote:
> Fabrice,
> You're well ahead of me.... can you elaborate just a bit. I have never needed to do this - so I am not fully understanding the help.
> Is there a way to read the functions of the dll?
> Sorry if I sound thick.
> Mike Allison
>
Message forwarded from pcsoft.us.windev

von Fabrice Harari.pcs.crosspost - am 30.04.2010 15:16
Fabrice,


Thanks for help. It does not look as straight forward as I had hoped. When I get the info, would you mind if I posted the info for a bit of extra guidance ?

Mike

von cardcoder - am 01.05.2010 10:11
Mike,
what dll are you talking about?
Mostly you need the documentation, supplied with the dll, to find out the functions and parameters you can call.
An ocx is actually a special kind of dll. You can think of a ocx holding visual elements (controls) where as a dll holds just functions you can call.


von Arie - am 01.05.2010 13:28
Post away, Mike, I'm sure somebody here will be able to help you

Best regards



von Fabrice Harari - am 01.05.2010 13:30
Hi Guys,

Can anybody help me with defining these vb.net variables as they would appear in windev.

Private m_ScannerManager As UFScannerManager
Private m_Scanner As UFScanner
Private m_Matcher As UFMatcher
Private m_Database As UFDatabase

I am trying to convert a finger print reader.

Many thanks,

Mike Allison

von cardcoder - am 04.05.2010 16:23
Mike, this sounds like a .net assembly. You need to include it in your project. Then you can do:
m_ScannerManager IS UFScannerManager
m_Scanner IS UFScanner
etc..

or (looking at the suprema website) you most likely can do (not tested because I do not have this stuff)
m_ScannerManager IS UFScannerManager
m_Scanner IS object UFScanner dynamic
m_ScannerManager:Init()
IF m_ScannerManager.Scanners.Count > 0
m_Scanner = m_ScannerManager.Scanners[0]
END
now you have a scanner-object and you can call scanner-functions and so on.

mmmh: WD10 I'm not sure. WD14 will do.

von Arie - am 04.05.2010 19:42
Arie,

Many thanks for your assistance. I will give it a go.

Mike



von cardcoder - am 05.05.2010 10:26
Guys,

I am losing the will to live here. As you can tell I am on a very steep learning curve.

Code is as follows -

CLASS
UFE30_DatabaseDemo is class
m_ScannerManager is UFScannerManager
m_Scanner is UFScanner
m_Matcher is UFMatcher
m_Database is UFDatabase
END

PROJECT CODE
m_ScannerManager is object UFScannerManager dynamic
m_Scanner is object UFScanner dynamic
m_UFDatabase is string

CMD_INIT_BUTTON
m_ScannerManager:Init()

- What happened?
Dynamic .NET object ('m_ScannerManager') not allocated.

What am I missing?

Many thanks in advance

Mike Allison



von cardcoder - am 06.05.2010 07:04
Mike,
because you defined m_ScannerManager to be dynamic (m_ScannerManager is object UFScannerManager dynamic) you need to allocate it your self at some point, once.

m_ScannerManager = NEW UFScannerManager

Then you have an instance of m_ScannerManager ready to be used.

btw: since I know you're in POS as well - I recently used the OPOS (OLE for POS) .NET layer to interact with a Dibal scale, inclusing a cashdrawer, linedisplay and printer. Quite interesting.

von Arie - am 06.05.2010 08:09
Arie,

Sorry to trouble you again. You seem to be the "guru" in this area.

I have read the help and see what you say. my code is below.

BT_Init
m_ScannerManager = new UFScannerManager

m_ScannerManager:Init()

Error:Wrong parameter for constructor of UFScannerManager class.
Main_000.by_init, Click Main_000.by_init, line 0, column 0

What am I doing wrong ?? I must be missing something so simple.

Mike




von cardcoder - am 06.05.2010 09:16
Hi Mike,
"guru"? I don't think so.

This error means that the scannermanager needs some info, when it is created.
Look at the constructor as a Create() function, which is automatically called when the object is created. In this case it would be Create(something), according to the error.

m_ScannerManager = new UFScannerManager(something)

But I do not have any glue about "something". That should be in your documentation. Maybe another "scanner" object you have to create first, using the same syntax as I mentioned.
Or just a parent acting as a placeholder for your object (so your object gets destroyed as well, when the parent is deleted/destroyed). In that case you could try NULL or 0. Maybe that will work.
m_ScannerManager = new UFScannerManager(null)


von Arie - am 06.05.2010 09:44
Hi Mike

you must have SOME kind of documentation about your dll... And in it, you should find what the constructor of the class is waiting for as arguments...

And your code should become something like:

m_ScannerManager = new UFScannerManager(ArgumentsAsDefinedByDocumentationHERE)

Best regards



von Fabrice Harari - am 06.05.2010 09:45
Fabrice / Arie,

I have the docs AND a demo VB program.

I am trying to match it bit by bit into windev. I have added it to the .Net assemblies of the project.

I know that I am doing something wrong which is obviously "stupid" on my part.

Error:Wrong parameter for constructor of UFScannerManager class.

Mike



von cardcoder - am 06.05.2010 10:50
Mike,
you need to change this line:
m_ScannerManager = new UFScannerManager
into this
m_ScannerManager = new UFScannerManager(something)

But since we don't have the documentation we cannot tell you what "something" must be.
An INT, a STRING, another OBJECT?

Maybe you can post a VB code snippet or some documentation?


von Arie - am 06.05.2010 12:16
Arie,

Here is the VB . net code.

Dim ufs_res As UFS_STATUS
Dim nScannerNumber As Integer

Windows.Forms.Cursor.Current = Cursors.WaitCursor
ufs_res = m_ScannerManager.Init()
Windows.Forms.Cursor.Current = Me.Cursor
If (ufs_res = UFS_STATUS.OK) Then
tbxMessage.AppendText("UFScanner Init: OK" & vbNewLine)
Else
UFScanner.GetErrorString(ufs_res, m_strError)
tbxMessage.AppendText("UFScanner Init: " & m_strError & vbNewLine)
Exit Sub
End If

nScannerNumber = m_ScannerManager.Scanners.Count
tbxMessage.AppendText("UFScanner GetScannerNumber: " & nScannerNumber & vbNewLine)

If (nScannerNumber = 0) Then
tbxMessage.AppendText("There's no available scanner" & vbNewLine)
Exit Sub
Else
tbxMessage.AppendText("First scanner will be used" & vbNewLine)
End If

m_Scanner = m_ScannerManager.Scanners(0)

If you would like to earn a couple of quid, give me a quick call on skype mike-fbs-ltd

Mike Allison





von cardcoder - am 06.05.2010 13:16
Mike,
this code snippet just misses the line where you get stuck in the first place.
About instantiating the UFScannerManager object. Do you have more info about that?

I could not find a download for the dll you're talking about (Suprema isn't it). I guess one have to pay for that or buy a fingerpint device.
Maybe you can send me the dll and docs by mail, then I will give it a try.
But since I do not have a real device, I can only go to some point.



von Arie - am 07.05.2010 09:04
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.