Announcement

Collapse
No announcement yet.

Visual Basic conversion (1 declare)

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

  • Visual Basic conversion (1 declare)

    I'm having trouble opening a cash drawer on a remote system (don't have a drawer.) Anyone see a problem with this code conversion?

    Do these drawers usually use ascii 1-8 or ASC("1") - ASC"("8")?

    Private Declare Function GetDrawerHandle Lib "MSPOS_USB.dll" (ByVal DrawerNumber As Byte) As Long
    DECLARE FUNCTION GetDrawerHandle LIB "MSPOS_USB.dll" ALIAS "GetDrawerHandle" (BYVAL DrawerNumber AS BYTE) AS LONG
    The world is full of apathy, but who cares?

  • #2
    Have you tried CHR$(8) or 0 or 1 or 2.....?
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.

    Comment


    • #3
      I sent the manufacturer some more test code.
      I added 48 to the drawer number to see if it works.
      Nobody has reported anything wrong with my headers so that is hopefully it. I'm writing this for a client that bought a cash drawer from this company in California.
      The world is full of apathy, but who cares?

      Comment


      • #4
        Hi Mike,

        A quick search for MSPOS_USB.DLL turned up this , which seems to suggest that drawer numbers start at zero.

        It also shows the return value for C++ as being ULONG, which I believe would translate into a DWORD in PB. However, it gives the return type for the same function in VB as INTEGER, which is certainly not a DWORD.

        Regardless of that last point, I'd try sending a 0 to the GetDrawerHandle function and see what comes back. I'd also load up the MSPOS_USB dll in Dependency Walker to make sure you're specifying the correct alias.

        Regards,

        Pete.

        Comment


        • #5
          E-mail pending to manufacturer. Unfortunately, can't test here.

          Trying unsuccessfully to get a fixed font.
          In USB POS DLL v110.PDF Visual Basic sample
          ----------------------- ----------------------
          Handle=GetDrawerHandle(0) DrawerHandle=GetDrawerHandle(DrawerNumber)
          1)Is GetDrawerHandle called with the drawer number or zero?
          2)Is the DrawerNumber ascii (1-8) or (49-57)?
          Last edited by Mike Doty; 10 Apr 2008, 06:52 PM. Reason: Have been unable to get fixed font with courier new
          The world is full of apathy, but who cares?

          Comment


          • #6
            Without the real API documentation, another guess would be
            Handle = GetDrawerHandle(0)
            Which from my work on creating a "Generic" version of USB code and Scouring "USB COMPLETE" would show that element 0 would contain a pointer (To what I haven't a clue???, could be a UDT, could be several, could be other info), which VB passes "ByRef" (The default) unless passed "ByVal"

            On top of that, from the looks of the document shown, if ANY of the dipswitches, are not in the default position (either by accident, or by someone fooling with them), then the results are "UnKnown" and you can not test application specifics such as this without a clone of what you are trying to code for.

            Just a word of caution from one that interfaces external hardware with computer software, "You can make guesstimations, but only by luck, can you get it right"
            Engineer's Motto: If it aint broke take it apart and fix it

            "If at 1st you don't succeed... call it version 1.0"

            "Half of Programming is coding"....."The other 90% is DEBUGGING"

            "Document my code????" .... "WHYYY??? do you think they call it CODE? "

            Comment


            • #7
              It was zero. It appears the drawer number is ascii (0-7).
              Thank you.
              The world is full of apathy, but who cares?

              Comment


              • #8
                Not a prob Mike

                Although I am sure there is a reason to be able to remotely open a "Cash-Drawer" I can not think of one (unless I was out to mess with someone as a prank, or do something illegal)

                The one legal idea I can think of is one brought to me a while back was a kiosk type of thing that users put in their money, get their picture taken, and for added security, whoever collects the money not only had to have the passcode to open the drawer/vault, but the main office had to know it was them trying to access (either by phone, or knowing it was time and human patterns etc) and allow the drawer to open from a remote location by issuing the "Open" code from a remote location)

                Needless to say, with my knowledge of USB at the time....I had to take a pass (just because I KNEEEEWWWW my lack of knowledge could bite me financially later, nomatter how good the system was)

                I guess I was just curious what the project presented to you was? And if you dare take it on?
                Engineer's Motto: If it aint broke take it apart and fix it

                "If at 1st you don't succeed... call it version 1.0"

                "Half of Programming is coding"....."The other 90% is DEBUGGING"

                "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                Comment


                • #9
                  Well, "remotely" doesn't necessarily mean "far away". Could be as simple as that the "cash register" is simply a PC running a cash register program which than opens the cash drawer attached to it for collecting money/giving out change.

                  Comment


                  • #10
                    Knuth is correct.
                    The world is full of apathy, but who cares?

                    Comment

                    Working...
                    X