Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

.Net DLL Framework

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • .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
    Re: .Net DLL Framework

    Did you try the OLE Automation browser to see if you can examine the dll?
    There can be only one.

    Comment


    • #3
      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

      Comment


      • #4
        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

        Comment


        • #5
          Re: .Net DLL Framework

          HI Kurt:

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

          Comment


          • #6
            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

            Comment


            • #7
              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

              Comment


              • #8
                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

                Comment


                • #9
                  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 ----

                  Comment


                  • #10
                    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

                    Comment


                    • #11
                      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 Files
                      Finian

                      Comment


                      • #12
                        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

                        Comment


                        • #13
                          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

                          Comment


                          • #14
                            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

                            Comment

                            Working...
                            X