Alpha Video Training
Results 1 to 14 of 14

Thread: .Net DLL Framework

  1. #1
    "Certified" Alphaholic
    Real Name
    Finian Lennon
    Join Date
    Apr 2000
    Location
    Atlanta, GA
    Posts
    1,805

    Default .Net DLL Framework

    I'm trying to communicate with an external .Net dll that controls a hand reader. I'm not having much luck. I can't come up with the first step that would allow me to look at the classes etc that are contained in the dll.

    Here's what I know: the instructions from the external dll tell me that its namespace is "RecogSys.RdrAccess". One of the many classes contained in the dll is called "CRsiComWinSock" and is required to establish an ethernet connection with the hand reader. The dll is called "RSIDotNetDLL.DLL" and I've placed a copy of the dll in A5's dot net path.

    A5 has a number of methods such as RegisterAssembly, RegisterNamespace, RegisterClass etc and most of the examples provided use the RegisterClass method.

    Here's what I've tried with RegisterClass

    Code:
    Dim Sv as DotNet::Services
    Dim Assy as DotNet::AssemblyReference
    Dim Namespace as C = "RecogSys.RdrAccess"
    Assy.FileName = DotNetPath() + "RSIDotNetDLL.dll"
    if .not. file.exists(assy.filename) then
    	ui_msg_box("","File not there.")
    	END
    end if
    rc = Sv.RegisterClass("RecogSys.RdrAccess", "MyComWinsock","CRsiComWinsock",Assy)
    This returns a '.Net Assembly dll not found" error.

    If I try to register the assembly as follows:

    Code:
    Dim Sv as DotNet::Services
    Dim Assy as DotNet::AssemblyReference
    Dim Namespace as C = "RecogSys.RdrAccess"
    Assy.FileName = DotNetPath() + "RSIDotNetDLL.dll"
    if .not. file.exists(assy.filename) then
    	ui_msg_box("","File not there.")
    	END
    end if
    rs = sv.RegisterAssembly(NameSpace,Assy)
    if .not. rs then
    	UI_Msg_Box("Error registering assembly " + Assy.fileName, sv.CallResult.Text)
        End 
    End if
    showvar(sv.callResult.text)
    I get:
    "Error in DotNet::Services::RegisterAssembly - Exception loading assembly
    Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework\v4.0.30319\RSIDotNetDLL.dll'
    or one of its dependencies. An attempt was made to load a program with an incorrect format."

    I've also tried RegisterNamespace without success.

    The dll publisher has provided a demo program using the dll that establishes communication with the reader, so it is possible.

    Can anyone spot syntax errors or suggest an approach that will help me get past the first hurdle?

    Thanks
    Finian

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: .Net DLL Framework

    Did you try the OLE Automation browser to see if you can examine the dll?

  3. #3
    "Certified" Alphaholic
    Real Name
    Finian Lennon
    Join Date
    Apr 2000
    Location
    Atlanta, GA
    Posts
    1,805

    Default Re: .Net DLL Framework

    Hi Stan:

    Yes, I looked. It doesn't appear there. I guess the processes for OLE/COM/ActiveX are different from .Net.
    Finian

  4. #4
    Alpha Software Employee Kurt Rayner's Avatar
    Real Name
    Kurt Rayner
    Join Date
    Oct 2006
    Posts
    15

    Default Re: .Net DLL Framework

    Hi Finnian,

    A couple of things to check:

    1. Are there DLLs that the assembly depends upon? If so, the directories for these files must be in the path.
    2. You also say that the DLL is in "A5's dot net path". Is this the .Net framework directory showing in the error(C:\Windows\Microsoft.NET\Framework\v4.0.30319\)? This is not necessary as long as you provide the full install directory path in your file name.
    3. In your code, your are using a dot in the target namespace. Alpha Five uses two colons "::" as C++ does.
    4. Your target namespace can be as simple as "MyNamespace". It is your own name and does not have anything to do with the DLL. It is there to prevent you from accidentally using the same name someone else has. I would recommend that you use RegisterAssembly and pass it a simple namespace - the is the one you will use in your Dim statement. By registering the entire assembly, you will see all of the namespaces in the assembly under the name you choose.

    Here is a slight modification of your example:

    Dim Sv as DotNet::Services
    Dim Assy as DotNet::AssemblyReference
    Dim Namespace as C = "MyNamespace"
    Assy.FileName = DotNetPath() + "RSIDotNetDLL.dll"
    if .not. file.exists(assy.filename) then
    ui_msg_box("","File not there.")
    END
    end if
    rs = sv.RegisterAssembly(NameSpace,Assy)
    if .not. rs then
    UI_Msg_Box("Error registering assembly " + Assy.fileName, sv.CallResult.Text)
    End
    End if
    showvar(sv.callResult.text)

    dim MyObject as MyNamespace::RecogSys::RdrAccess::CRsiComWinSock

    Regards,

    Kurt

  5. #5
    "Certified" Alphaholic
    Real Name
    Finian Lennon
    Join Date
    Apr 2000
    Location
    Atlanta, GA
    Posts
    1,805

    Default Re: .Net DLL Framework

    HI Kurt:

    Thanks for the suggestions. I'll try them out today.
    Finian

  6. #6
    "Certified" Alphaholic
    Real Name
    Finian Lennon
    Join Date
    Apr 2000
    Location
    Atlanta, GA
    Posts
    1,805

    Default Re: .Net DLL Framework

    Hi Kurt:

    Maybe this won't be possible ... I get the following error:

    "Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information."

    It's accurate, the dll is built against the version mentioned. What sort of additional information might be required?
    Finian

  7. #7
    Alpha Software Employee Kurt Rayner's Avatar
    Real Name
    Kurt Rayner
    Join Date
    Oct 2006
    Posts
    15

    Default Re: .Net DLL Framework

    Hi Finnian,

    Before trying too many things, I would ask the vendor if there is an assembly built for .Net 4.0.

    If there is no assembly available for .Net 4.0, you may need to create a configuration file for alpha5.exe (called alpha5.exe.config) that contains the following:

    <?xml version ="1.0"?>
    <configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
    </startup>
    </configuration>


    For more information on the issue of "mixed-mode" assemblies see one of the following links:
    Regards,

    Kurt

  8. #8
    "Certified" Alphaholic
    Real Name
    Finian Lennon
    Join Date
    Apr 2000
    Location
    Atlanta, GA
    Posts
    1,805

    Default Re: .Net DLL Framework

    Hi Kurt:

    There is no assembly available for .Net 4.0 but, yikes! That config file suggestion worked as is. I can see all the methods of "MyObject" in the interactive window.

    I'm going to keep on digging into this. If there are no hiccups, it should be a lot easier to work with than the other available DLL I've been trying to work through using Declare, Declarestruct etc.

    Thanks
    Finian

  9. #9
    "Certified" Alphaholic Marcel Kollenaar's Avatar
    Real Name
    Marcel
    Join Date
    Apr 2003
    Location
    Twente
    Posts
    1,514

    Default Re: .Net DLL Framework

    Finian and Kurt,

    Thanks for this information! This info creates a lot a new opportunities. Is it also possible in V10 or solely for v11?
    Marcel

    I hear and I forget. I see and I remember. I do and I understand.
    ---- Confusius ----

  10. #10
    Alpha Software Employee Kurt Rayner's Avatar
    Real Name
    Kurt Rayner
    Join Date
    Oct 2006
    Posts
    15

    Default Re: .Net DLL Framework

    Hi Marcel,

    .Net support is really a version 11 feature. We did put out a somewhat experimental build of Alpha Five version 10 that had limited .Net integration, but that was mainly to verify the migration from Visual Studio 6.0 to Visual Studio 2010.

    I'm sure you won't be surprised if I encourage you to move all of your applications to version 11, but from a technical standpoint, this version of the product is far superior. The support for .Net is something we are dependent on internally (eating our own dog food - so to speak) for both the Alpha Five Web Server and the work we are doing on integrating into Microsoft IIS 7. We also have started supporting ASP and WCF web services.

    Regards,

    Kurt

  11. #11
    "Certified" Alphaholic
    Real Name
    Finian Lennon
    Join Date
    Apr 2000
    Location
    Atlanta, GA
    Posts
    1,805

    Default Re: .Net DLL Framework

    I've hit a wall trying to use the rsidotnetdll.dll. Using one alternative method of setting the Hand Reader address "appears" to work but the reader doesn't react to any of the commands I send. I used this method because the usual method of setting the address was sending back an error, a screen capture of which I have attached.

    Basically the Reader.SetAddress(Address) method of the control expects a byte value (usually 0) to be passed. However Alpha "translates" this method as taking a "Addr as p" argument. If I try to create a pointer (eg. Dim addr as p, addr.addr = 0) and pass that, I get the attached error about using iConvertible. I've read some stuff about this but don't see how to apply it here.

    Thanks for any ideas or suggestions.
    Attached Images Attached Images
    Finian

  12. #12
    Alpha Software Employee Lenny Forziati's Avatar
    Real Name
    Lenny Forziati
    Join Date
    Nov 2001
    Location
    Alpha Software
    Posts
    4,695

    Default Re: .Net DLL Framework

    Did you try passing a numeric 0 to the method anyway?

    Lenny Forziati
    Vice President, Internet Products and Technical Services
    Alpha Software Corporation

  13. #13
    Alpha Software Employee Kurt Rayner's Avatar
    Real Name
    Kurt Rayner
    Join Date
    Oct 2006
    Posts
    15

    Default Re: .Net DLL Framework

    Hi Finnian,

    Lenny's suggestion may work. In the mean time, I see the missing type mapping and have made a change.

    Please try this again with any build beginning with version 11 build 2208.

    Regards,

    Kurt

  14. #14
    "Certified" Alphaholic
    Real Name
    Finian Lennon
    Join Date
    Apr 2000
    Location
    Atlanta, GA
    Posts
    1,805

    Default Re: .Net DLL Framework

    Hi Lenny and Kurt:

    Yes, I tried passing just the 0 but I got "Property not Found" I think.

    I'll download the other build and try it.

    Thanks guys.
    Finian

Similar Threads

  1. A5V10.5 Build 3307.3591 Studio 10 - MSVCR100.dll MSVCP100.dll error on install
    By Granville Chandler in forum Alpha Five Version 10 - Desktop Applications
    Replies: 0
    Last Post: 09-09-2010, 05:39 PM
  2. MS Net Framework 4
    By Jerry Hartness in forum Alpha Five Version 10 - Desktop Applications
    Replies: 3
    Last Post: 09-09-2010, 10:18 AM
  3. RFC for Alpha Software re: .NET framework requirement
    By fsi in forum Application Server Version 10 - Web/Browser Applications
    Replies: 0
    Last Post: 08-24-2010, 01:07 PM
  4. 16 Feb 2009 : ASP.net or .net code on WAS
    By yemulss in forum Application Server Version 9 - Web/Browser Applications
    Replies: 0
    Last Post: 02-16-2009, 10:41 AM
  5. sec framework - groups without framework
    By Steve Wood in forum Application Server Version 8
    Replies: 3
    Last Post: 04-09-2007, 02:44 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •