Overview & Features System Requirements Screen Shots
Ordering Info Obtaining Support Sample Code Downloads

Sample Code

This section contains example code for integrating and automating Retail @dvantage PC into your businesses own proprietary and non proprietary systems. The examples are written in 32-bit Visual Basic and Visual Basic for Applications. (VB5-6 compatible)

All code herein is unsupported by Encom Inc., and is provided as is, without warranty or claims of usability of any kind. This code is intended for example and reference purposes only! Its' use, as is or modified, negates any and all possible liability of Encom Inc. These terms are also stated in the Retail @dvantage PC licensing and service agreements which must be accepted prior to installation.

Shell Retail @dvantage PC from another application, or macro, and wait for the shelled process to end:
'==========================================================
'THE FOLLOWING EXAMPLE;
' - CAN BE ADDED TO TOOLBARS & MACROS IN ALL MICROSOFT
' - OFFICE PRODUCTS and OTHER VBA ENABLED APPLICATIONS.
' - IS CODE READY FOR 32 bit VisualBasic
'Note: Details for the RetailPC command line parameters
'are listed in the 'application's help file and user’s
'manual. The help files for both hosts are available in the
'downloads section.
'==========================================================
'__________________________________________________________
' Include the following declarations and data types in a
' .Bas module or in the forms 'declarations. (Form API &
' Type declarations should be converted to Private Types.)
'__________________________________________________________

Public Type STARTUP_INFO
    cb As Long
    lpReserved As String
    lpDesktop As String
    lpTitle As String
    dwX As Long
    dwY As Long
    dwXSize As Long
    dwYSize As Long
    dwXCountChars As Long
    dwYCountChars As Long
    dwFillAttribute As Long
    dwFlags As Long
    wShowWindow As Integer
    cbReserved2 As Integer
    lpReserved2 As Long
    hStdInput As Long
    hStdOutput As Long
    hStdError As Long
End Type

Public Type PROCESS_INFORMATION
    hProcess As Long
    hThread As Long
    dwProcessID As Long
    dwThreadID As Long
End Type

Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal
    dwMilliseconds As Long
Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
    hHandle As Long, ByVal dwMilliseconds As Long) As Long
Declare Function CreateProcessA Lib "kernel32" (ByVal _
    lpApplicationName As Long, ByVal lpCommandLine As String, _
    ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes _
    As Long, ByVal bInheritHandles As Long, ByVal _
    dwCreationFlags As Long, ByVal lpEnvironment As Long,_
    ByVal lpCurrentDirectory As Long, lpStartupInfo As _
    STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION)_
    As Long
Declare Function CloseHandle Lib "kernel32" (ByVal hObject _
    As Long) As Long
Public Const NORMAL_PRIORITY_CLASS = &H20&

'---------------------------------------------------------
'_________________________________________________________
' Create a button(or menu item) on the form and name it
' BtnProcess. Next add the following code to the click event.
'_________________________________________________________

Private Sub BtnProcess_Click()
  '-------------------------------------------------------
  ' Click event calls the ExecCmd function which shells
  ' and monitors an applications process.
  '-------------------------------------------------------
   MousePointer = 11
   On Error GoTo 0
   DoEvents
   'string to hold program path/filename and optional
   'command line arguments
   AppCmd$ = "C:\Program Files\RetailPC\RetailPC.exe <CmdLine Args>"
   x& = ExecCmd(AppCmd$)
   If x& = 0 Then GoTo No_process
  enable_form: '
   DoEvents
   MousePointer = 0
   Exit Sub
  no_process: '
    MsgBox "Cannot Access Retail @dvantage PC!", & _
      vbExclamation, "Retail PC Integration Example"
    GoTo Enable_form
End Sub
'----------------------------------------------------------
'__________________________________________________________
'Include this function in the same form or in a .Bas module.
'__________________________________________________________

Public Function ExecCmd(cmdline$) As Boolean
  '-------------------------------------------------------
   ' This procedure shells / starts APP in a monitor-able
  ' Process and does not exit unless the process could not
  ' start or the process completed and ended.
  '-------------------------------------------------------
  Dim Proc As PROCESS_INFORMATION
  Dim Start As STARTUPINFO
  Dim Ret&
  ' Initialize the STARTUPINFO structure:
  Start.cb = Len(Start)
  ' Start the application & return the Proc variable – open
  ' the Process handle
  Ret& = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, _
     NORMAL_PRIORITY_CLASS, 0&, 0&, Start, Proc)
   ' Process must start or we exit w/ value of false.
  If Ret& = 0 Then ExecCmd = False: Exit Function
  ' Wait for the shelled application to finish:
  ' Sleep milliseconds
  Sleep 1000
Ret_loop: '
  Ret& = WaitForSingleObject(Proc.hProcess, 500)
  ' wait 500 milliseconds then return status
  Select Case Ret&
     Case 258 ' = 'Wait Timeout' / process still active.
       ' Add screen refresh code here if necessary:.
       ' Add ‘CancelBtn clicked’ or ‘End Monitoring’ code here.
       DoEvents
       GoTo Ret_loop ' continue to wait
  End Select
  ' Process has ended so we close the handle opened w/
  ' the CreateProcess API
  Ret& = CloseHandle(Proc.hProcess)
  ExecCmd = True
End Function
'--------------------------------------------------------


10 Jan 2009 ::: News Update
Retail @dvantage PC Versions 4.0c and 4.0e:
Global Payments Inc. is in the process of certifying versions 4.0c and 4.0e. These new versions will support Microsoft Windows VISTA and also include new features such as a SSL connectivity option, Native support for USB card readers, and maintain compliance with new Payment Card Industry Data Security Standards. (PCI/DSS,PABP/CISP).
    read more...


01 Jan 2009 ::: News Header
Build 12 for Versions 3.4c & 3.4e have been Released as of January 1, 2009.
This new build adresses the New Double Receipt Truncation requirements, mandated by some states and also contains a few other minor bug fixes.

All New and Replacement orders will automaticallly receive the new build.
Existing merchants are not required to obtain the new build unless it is mandated in that merchant's state.


Need An Extra Hand?

Rent-A-Coder
If you' have a small project that does not require vast resources or staffing. We can provide you a referral for one our expert programmers.
     read more...



Rent-A-Tester
Developed your own product, web site, etc.. and need an independent tester? We can provide you a referral for one our expert technicians.
     read more...



Rent-A-Designer
Need a Graphical or Multimedia designer for a small project? We can provide you a referral for one our creative designers.
     read more...







Home      Services      Products      Partners      About Us      Contact Us
Copyright © 2006-2010 Encom Inc. All rights reserved.