visual c++ - OPOS_E_NOSERVICE after return from DllGetClassObject() in simple ATL COM OPOS Service Object -


an example msr opos service object writing not initializing properly. adding question others run same problem since various searches resulted in no whatsoever.

my question is: how can determine method in opos service object missing? there utility of kind can exercise opos service object , tell me missing? there way determine methods interface expected provide , missing?

i following procedure in writing opos service object using atl in order learn how opos service object created. using visual studio 2005 under windows xp. test basic functionality using ncr retail services manager (rsm) utility create profile msr in order test basic functionality of mag stripe reader simulator service object.

the visual studio project creates com object , registers properly. when attempt use diagnostics function of rsm on service object profile receive error of opos_e_noservice. have created log file logging function in com object shows service object loaded, dllmain() function of com object invoked , dllgetclassobject() invoked. second log file logs various service object interface methods not created indicating none of service object interface methods called.

so appears there problem service object interface fails check done @ time com object loaded.

the dllgetclassobject() function generated visual studio atl project wizard , should require no changes.

using microsoft pos .net sample utility comes pos .net 1.12 tried using sample utility. can see profile created ncr rsm in tree control under msr node. when attempt open there error message. windows event log shows follow error.

microsoft.pointofservice.poscontrolexception: method open threw exception. service object not support 1 or more of methods required release.

i found missing method inspection , review of code. turns out there single missing method, openservice() visual studio 2005 atl interface wizard had not created properly, possibly because first method added interface service object.

when attempted add method interface using visual studio class wizard, wizard issued error message after entered method signature wizard dialog , pressed next button.

when retrying scratch new atl project, error dialog had following text:

add/remove operation impossible, because code element 'openservicew' read only.

while method did show in visual studio ui in class view when clicking on method, interface definition in .idl file showed empty.

interface ivirtso : idispatch{ }; 

i closed visual studio reopened project , tried add again time getting error message:

failed return new code element. possibly syntax error. new element name: openservice

further investigation indicates there openservice() method in windows api , may visual studio 2005 ran conflict between trying add method service object , existing in windows api (actual name appears openservicew()).

what ended doing add interface method same signature, named checkservice() using class wizard , changed interface method name everywhere existed in generated code openservice() including couple of places checkservice part of name or label. reason visual studio class wizard thought interface method of openservice() existed when in fact did not.

however before able successfully, had first exit visual studio delete intellisense files (.ncb file , .suo file) adding new methods using class view wizard work properly. before deleting files, id number of add -> method in wizard kept incrementing method add failing. after deleting intellisense file id number started @ 1 again , able add checkservice() method wizard , modify method name openservice() hand using find tool "match case" turned on , "match whole word" turned off.

the way can see far review opos service object specification against source code implementation of service object.

i looking other possible solutions finding methods missing opos service object.

from article , current experience, appears following common subset of methods need available in opos service object in order service object load properly. of these invoked once part of starting , initialing service object. others, such getpropertynumber() , getpropertystring() set versions of these may invoked multiple times part of setting service object environment. there may other entry points offered particular opos common controls object particular device type need have corresponding method in service object.

hresult openservice(bstr deviceclass, bstr devicename, idispatch* pdispatch, [out, retval] long* prc); hresult checkhealth(long level, [out, retval] long* prc); hresult claimdevice(long claimtimeout, [out, retval] long* prc); hresult clearinput([out, retval] long* prc); hresult closeservice([out, retval] long* prc); hresult cofreezeevents(variant_bool freeze, [out, retval] long* prc); hresult directio(long command, [in, out] long* pdata, [in, out] bstr* pstring, [out, retval] long* prc); hresult releasedevice([out, retval] long* prc);  hresult getpropertynumber(long propindex, [out, retval] long* pnumber); hresult getpropertystring(long propindex, [out, retval] bstr* pstring); hresult setpropertynumber(long propindex, long number); hresult setpropertystring(long propindex, bstr propstring); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -