Author |
Messages |
|
cywareinc Posts:3
|
11/07/2009 3:55 AM |
Alert
|
Hi,
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
STDMETHODIMP Process (LPDISPATCH* pDispatch) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) _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.
|
|
|
|
|
cywareinc Posts:3
|
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. |
|
|
|
|
cywareinc Posts:3
|
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. |
|
|
|
|
cooltechgy Posts:1
|
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. |
|
|
|
|
|