Implement COM interface C++ / VC++ 6.0 / MFC

2

Entry level programmer here trying to implement a COM interface. I am working on a program that interfaces with the Aloha point of sale system. Aloha uses COM to work with external programs. I am trying to intercept card data from the mag card reader, which is an OPOS reader, not a keyboard wedge. The documentation I have doesn't explain how to implement this particular interface, but it does explain how to implement a similar one. I have tried to follow this example but I am getting no where. Support from Aloha is non-existent, their documentation is poor, outdated and sometimes just wrong, even though I have paid for a license.

I tried to make a simple app just to test this functionality. Here is what I did:

1) create a new project in vc++ 6.0 using ATL COM app wizard 2) server type dll 3) insert new atl object -> simple object 4) right click on my new class and choose implement interface 5) browse for type library, chose Iber.tlb (Aloha's tlb) 6) chose the interface I want to implement

That made a .h, .cpp and .rgs file.

The .h file has:

public:
// IInterceptMagcard
    STDMETHOD(InterceptMagcard)(BSTR bstrAccountNumber, BSTR bstrCustomerName, BSTR bstrExpirationDate, BSTR bstrTrack1Info, BSTR bstrTrack2Info, BSTR bstrTrack3Info, BSTR bstrRawMagcardData, LONG * bWasDataHandled)
    {
        if (bWasDataHandled == NULL)
            return E_POINTER;

        return E_NOTIMPL;
    }

Is that where I implement my code? I put some test code in there to write out to a txt file just to test it. I then used:

HRESULT hr = CoCreateInstance(CLSID_AlohaMag, NULL, CLSCTX_INPROC_SERVER,
                                IID_IAlohaMag, (void **) &g_pIInterceptMagcard);

where g_pIInterceptMagcard is a pointer to my interface class created with the wizard above.

When I try to register I get the following HRESULT: 0x80040112 That is "class not licensed for use."

Does that mean my program didn't make the necessary registry entries?

c++
visual-c++
com
atl
asked on Stack Overflow Jul 6, 2011 by Bob

1 Answer

1

It probably means there is a license you have to install before their custom class factory will create an instance of the class. Did you try running your program on a fully working POS system with the magnetic card swipe licensed for use? Maybe there is some other license that you need to do this type of thing?

If it was a problem of the class not being registered, the result would be "class not registered". It sounds like you've done the necessary steps via the wizard to implement the interface and have it generate the correct registry entries.

answered on Stack Overflow Jul 6, 2011 by (unknown user)

User contributions licensed under CC BY-SA 3.0