Page 1 of 2 12>
Topic Options
#193066 - 2009-03-23 02:35 PM Help with DynaWrap/DynaCall...
Viggen Offline
Starting to like KiXtart

Registered: 2002-03-22
Posts: 110
Hi all!

I have read the tutorials, on how to use DynaWrap/DynaCall, but I'm still lost on this one...

I have include the dll I need to use, and I wonder if someone (Apronk?) could help me in the right direction on how to call it.

I can get as far as creating the DynamicWrapper-object, but that's it \:\(

T.I.A

/Viggen


Attachments
BCP5Control.zip (712 downloads)
Description:



Top
#193076 - 2009-03-23 05:42 PM Re: Help with DynaWrap/DynaCall... [Re: Viggen]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4482
Loc: USA
What do you want to do with it? Do you have any documentation on this DLL?
Top
#193078 - 2009-03-23 06:04 PM Re: Help with DynaWrap/DynaCall... [Re: Allen]
Viggen Offline
Starting to like KiXtart

Registered: 2002-03-22
Posts: 110
The dll is needed to get data from a barcode reader.
In the so called SDK for it, there was an ocx, and I had no problem connecting to the reader, but I couldn't get any data.

I mailed the support (in Taiwan...) and they answered, that they don't support it any longer, and sent me the dll...
(with no docs at all), so I tried to register it with Regsvr32 which didn't work...
I mailed them again and they haven't answered in 10 days

I have opened the file in Visual C++ 2008 express edition, and I can see what "calls" I have to make (their allmost the same as in the ocx), but i can't figure out how to use the DynamicWrapper.
(I guess I need to use that, or is there another way to do it?)

/Viggen

Top
#193087 - 2009-03-23 08:24 PM Re: Help with DynaWrap/DynaCall... [Re: Viggen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22343
Loc: OK
oh, so it's not com aware.
that's a pita. can't really USE it in kixtart.
_________________________
!

download KiXnet

Top
#193096 - 2009-03-23 10:33 PM Re: Help with DynaWrap/DynaCall... [Re: Lonkero]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4482
Loc: USA
Well, that's the hope in dynawrapper... but with no docs its gonna be tough.
Top
#193103 - 2009-03-23 11:47 PM Re: Help with DynaWrap/DynaCall... [Re: Allen]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
But he has the OCX source code, which makes the DLL calls under-the-covers ... so might be a straight-forward mapping ...

But since the OCX failed to read the data from the DLL, wouldn't place much hope on dynawrapper being any different ... but hey go for it man !

Top
#193105 - 2009-03-24 12:15 AM Re: Help with DynaWrap/DynaCall... [Re: Shawn]
Viggen Offline
Starting to like KiXtart

Registered: 2002-03-22
Posts: 110
Umm... I might be missing something here... \:\)
but when I used the ocx, I didn't have a dll at all.

and the "big" difference between the ocx and the dll is that the ocx used "DownloadData", while the dll uses "UploadRecords".
(since this is waaaay out of my league, I don't know if it means anything) \:D

and about that "source code for the ocx... nope... they supplied a vb-file, so with that and typelib viewer I figured it out.

Oh! and I forgot one thing... They sent a demo.exe which uses the dll, and that demo can get the data from the reader, into a textbox.

/Viggen


Edited by Viggen (2009-03-24 12:19 AM)

Top
#193106 - 2009-03-24 12:17 AM Re: Help with DynaWrap/DynaCall... [Re: Viggen]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
I guess no source code for the demo.exe ?
Top
#193107 - 2009-03-24 12:25 AM Re: Help with DynaWrap/DynaCall... [Re: Shawn]
Viggen Offline
Starting to like KiXtart

Registered: 2002-03-22
Posts: 110
hmm... hang on...

I got this.

(but, personally, since this is not my cup o' tea, I found out more, with the "Visual C++ express"-thingy)


Attachments
BCP5000 SDK VS.NET2005.rar (701 downloads)
Description:



Top
#193112 - 2009-03-24 02:26 AM Re: Help with DynaWrap/DynaCall... [Re: Viggen]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Just fired-up VS 2005 and checked-out that project with the component.

That control is named "BCP5Control" yeah ? It actually appears as the progress bar along the top of the form ... cool idea.

Anyway, that control is actually a VB.NET control ... written back in .NET 1.1 ... that makes things even trickier (x2) ...

1) Its a .NET control - not a COMable object

2) Its probably not DynaWrappable ... jury's still out

3) Since its a control, it needs a "container" to live in - like VB.NET or even maybe Internet Explorer ...

Any of this ring true ? The OCX you had would have probably worked with the older VB6 ... that "might" be COMable (because OCX's are just standardized COM objects) ... can we get our hands on that ?

-Shawn

Top
#193113 - 2009-03-24 06:58 AM Re: Help with DynaWrap/DynaCall... [Re: Shawn]
Viggen Offline
Starting to like KiXtart

Registered: 2002-03-22
Posts: 110
Here's the ocx and the "sdk", that dosen't even work...

I made a small test with the help from the vb-file, and from what I found in TypeLib Viewer.

Perhaps I have missed something, since I can't get the data from it?

Would KiXforms.NET work as a container?



 Code:
$Port = 12

$Pwd = "1234"

 

$bcreader = CreateObject("BCP5Ctrl.BCP5Controller")
?? @error
$open = $bcreader.OpenBCP($Pwd,$Port)
? $open

debug on
$text = $bcreader.DownloadData

; If $Port or $Pwd is wrong it displays "Device did not open", else it displays "Communication failed to establish."
 

$nul = $bcreader.EraseData
; Even though I get a "Communication failed...", (on the "DownloadData") it erases all data in the scanner.
; Which indicates that the comm. is in fact working?

 
$close = $bcreader.CloseBCP




Attachments
BCP5Ctrl.zip (641 downloads)
Description:

BCP5OCXDemo.zip (643 downloads)
Description:




Edited by Viggen (2009-03-24 07:06 AM)

Top
#193115 - 2009-03-24 12:55 PM Re: Help with DynaWrap/DynaCall... [Re: Viggen]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
The OCX seems to be very COMable ... you said the vb demo application works fine eh ? What specific actions and buttons did you use with the demo. I assume you started like:

1) Selected a COM port
2) Entered password in password box.
3) Clicked the "OpenBCP" button ...

What next ...

Top
#193116 - 2009-03-24 01:47 PM Re: Help with DynaWrap/DynaCall... [Re: Shawn]
Viggen Offline
Starting to like KiXtart

Registered: 2002-03-22
Posts: 110
After that I click the "Upload Data"-button, and wait for the data to appear in the textbox.

The next step is to "Erase Data" or "CloseBCP"

Top
#193118 - 2009-03-24 02:20 PM Re: Help with DynaWrap/DynaCall... [Re: Viggen]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
hmmmm, looking at your script above ... I think you did a great job in reverse engineering the OCX and scripting something that "should" work ;-)


Re-reading your comments, the problem your having is only with the DownloadDATA method eh ? (You said the EraseData erases fine) ...

1) You getting anything returned in the $text variable ? Whats the LEN($text) ?

2) Whats the @SERROR after your DownloadDATA ?

Top
#193119 - 2009-03-24 02:26 PM Re: Help with DynaWrap/DynaCall... [Re: Shawn]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Seems to display the value of CommPort ok after the OpenBCP method ...

?"ComPort = " + $bcreader.CommPort

Top
#193122 - 2009-03-24 02:50 PM Re: Help with DynaWrap/DynaCall... [Re: Shawn]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Does this vbscript version behave same (vbscript has better COM support) ... it appears to on my end ...

 Code:

Dim bcReader 
Dim port
Dim password
Dim text

port = 12
password = "1234"

Set bcReader = CreateObject("BCP5Ctrl.BCP5Controller")

bcReader.OpenBCP password, port

WScript.Echo "Opened = " & bcReader.Opened

text = bcReader.DownloadData()

WScript.Echo "text = " & text

bcReader.CloseBCP


Top
#193123 - 2009-03-24 02:55 PM Re: Help with DynaWrap/DynaCall... [Re: Shawn]
Viggen Offline
Starting to like KiXtart

Registered: 2002-03-22
Posts: 110
It took some guesswork, but I got some results =)

When I get to "$text = $bcreader.DownloadData" and press enter (in debug mode)
It takes a few sec. and then I get a messagebox telling me "Communication failed to establish."

? Len($text) = 0

The @serror is "The operation completed successfully"
(I'm guessing that this is the result of the messagebox displaying)

I have had some form of result from every "call" in the ocx, except the DownloadData.

Top
#193124 - 2009-03-24 03:02 PM Re: Help with DynaWrap/DynaCall... [Re: Shawn]
Viggen Offline
Starting to like KiXtart

Registered: 2002-03-22
Posts: 110
Sorry

I get a "Opened = False"

Then I get a "Device did not open."

and after that I get "text = "

Top
#193125 - 2009-03-24 03:03 PM Re: Help with DynaWrap/DynaCall... [Re: Viggen]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
I'm seeing the same - everything except DownloadData appears to work. Able to try that VB script version above ?
Top
#193126 - 2009-03-24 03:05 PM Re: Help with DynaWrap/DynaCall... [Re: Shawn]
Viggen Offline
Starting to like KiXtart

Registered: 2002-03-22
Posts: 110
Yes, thats when I get the "Opened = False" \:\)
Top
Page 1 of 2 12>


Moderator:  Shawn, ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 144 anonymous users online.
Newest Members
Jodey, Hiker, GTRoberts, KatieQuinn, Brennnnn
17684 Registered Users

Generated in 0.045 seconds in which 0.012 seconds were spent on a total of 17 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org