Untitled Document
Microsoft Dynamics RMS Experts
  Register   Login
RMS Experts
  You are Here: Dynamics RMS Community ... Dynamics RMS and POS Forums
RMS and POS Forums
Subject: C++ Add-In Hook

You are not authorized to post a reply.   
Author Messages

11/07/2009 3:55 AM Alert 

I was able to create an MFC/ATL DLL written in C++ that works with RMS.  So far, I've created an InitializeTransaction and the TenderBegin hook.  I do have one major problem:  RMS does NOT seem to get the correct return code (should be TRUE) when the TenderBegin hook executes because it does not continue to display the tender entry screen.  Using VB6, the code executes properly.  Below is the sample code I'm using for both VB6 and VC6:

Public Function Process (mySession as Object) as Boolean
    MsgBox ("TenderBegin-->Hook")
    Process = True  //  THIS WORKS...RMS proceeds to the tender screen
End Function

    _SessionClass clsSession (pDispatch);

    //  EXAMPLES of what I've treied
    return TRUE;  //  This does NOT work
    return S_OK //  This also does NOT work
    return S_ERROR  //  This prompts RMS to display an error message

All I need is to learn how to tell RMS that I want to continue processing so that the tender entry screen appears after my add-in hook is called.

Any help would be greatly appreciated.  Thanks.


11/11/2009 8:29 AM Alert 
Solved the problem...finally. Using ATL is not the way to create an RMS add-in. For the benefit of C++ programmers, I will explain how to make it work using VC6. BTW, we are using VC6 to keep the footprint of our add-in small.

1) Create a new MFC App Wizard DLL project
2) Import the QSRules.dll objects
a) Go to Class Wizard
b) Add a new class from type library which will prompt you to select a file
c) Select the QSRules.dll file
d) You will be given a choice of which classes you want to include in your project
e) Select the classes you need (i.e. _Session, _Transaction etc..)
f) When you click "Ok" a header and cpp file will be generated containing the classes you selected
3) Create your add-in class
a) Go to Class Wizard
b) Add a new class, enter the class name and choose the base class CCmdTarget
c) Check either the "Automation" or "Createable by TypeId" radio button
4) Create the Process Function
a) Go to Class Wizard
b) Click on the Automation Tab
c) Select your newly created add-in class
d) Add a method with a return type of BOOL and an argument of type LPDISPATCH
5) Access QSRules objects in your Process function
a) To access the Session object and child objects:

BOOL RmsAddIn::Process(LPDISPATCH pDispatch)
// Get the session class
_SessionClass mySession (pDispatch);

// Get the cashier class
_Cashier myCashier (mySession.GetCashier ());

AfxMessageBox (myCashier.GetName ());

// Return TRUE or FALSE if error
return TRUE;

6) Compile and build the application
7) Move the DLL into the Add-Ins directory of RMS
8) Alter the registry to invoke your Add-In hook/button routine

Hope this helps.

11/11/2009 8:31 AM Alert 
One last thing, after moving your DLL to the Add-Ins directory, make sure you register the component by running regsvr32.exe against the DLL.

01/23/2011 11:16 AM Alert 
hi cywareinc

How can i get in contact with you via email or im?

i need your advice.
You are not authorized to post a reply.

ActiveForums 3.6
Get RMS Training Today
Get RMS Training today!
(c) 2006-2012 Retail Hero ®