This section describes the sample files included in the SDK for implementing an Other Card component. It also details what modifications, if any, must be made to each file to customize it. Many of the following files contain the comment MOD TODO
to indicate each line that requires modification. Search each file for the MOD TODO
comment to customize the files for your Other Card.
Note Comments are not allowed in the MyCard.rgs file, so that file has no MOD TODO comments, even though changes are required. See this section for more information.
This key source file is generated by the ATL Wizard, and handles DLLMain integration. This file requires no changes.
This header file handles the declaration of the COtherCardObject class.
Modify the ProgID to reflect the name of your Other Card. In the following strings, change the VCCard string to match the name of your custom credit card:
// MOD TODO: This is the program id of the other card being created. Change
// the four occurrences of VCCard to <YourCardName> This must be modified to
// reflect the naming of your Card.
#define OtherProgID "VCCard.VCCard.1"
#define WideOtherProgID L"VCCard.VCCard.1"
// MOD TODO: Change &CLSID_VCCard to &CLSID_<YourCardName>
// MOD TODO: Change both occurrences of &LIBID_VCCardLib to &LIBID_<YourCardName>Lib
public CComCoClass<CVCCard, &CLSID_VCCard>,
public IDispatchImpl<ICreditCardOtherCard, &IID_ICreditCardOtherCard, &LIBID_VCCardLib>,
public IDispatchImpl<IPaymentCCTypeInstall, &IID_IPaymentCCTypeInstall, &LIBID_VCCardLib>
This source file implements the member functions of the ICreditCardOtherCard interface that is used to create and configure credit cards in the consumer's Payment Selector. Use the provided interface functions GetBitmap, IsValid, and GetMask to manage instances of the Other Card. Explanation and examples of function syntax are provided in the "Credit Card Component (Other Card) Interfaces" section.
The file MyCard.ccp contains the comment MOD TODO
to indicate each line that requires modification. Search the file for the MOD TODO
comment to customize the file for your Other Card.
The sample Other Card implementation contains two credit cards: Microsoft Card and Microsoft Gold Card. In the following section, change the name of the accepted credit card type from the default MSCard or MSGCard to the short name of your Other Card. Also, change the display (friendly) names to the display names of your cards. You can also change the names of the constants, but if you do, change all occurrences in the file.
You can also indicate the maximum number of credit cards allowed for this type:.
// MOD TODO: Change the number of cards you are installing here (cMaxCards).
// MOD TODO: Change the two card name strings, = L"VCCard"; to = L"<YourCardName>";
// MOD TODO: Change the two friendly name strings, = L"Volcano Coffee Card" to
// = L"<Your Friendly Card Name>";
static const int cMaxCards = 2;
static const OLECHAR* szVCName = L"VCCard";
static const OLECHAR* szVCGName = L"VCGCard";
static const OLECHAR* szVCFName = L"Volcano Coffee Card";
static const OLECHAR* szVCGFName = L"Volcano Coffee Gold Card";
Next, change the credit-card number mask to reflect the configuration of numbers on your card. Change the following section:
// MOD TODO: These are the masks that are returned to the Add/Modify you can only
// use n = numeric and a = alpa and x = alph/numeric
//
static const OLECHAR* szVCNameMask = L"nnn-aaa-nnn";
static const OLECHAR* szVCGNameMask = L"nnn-a-nnn";
static const unsigned int cVCCard = 9;
static const unsigned int cVCGCard = 7;
For example, if your card uses four groups of four digits (for example, 1111 1111 1111 1111), change the previous code to the following:
static const OLECHAR* szMask = L"nnnn-nnnn-nnnn-nnnn";
static const unsigned int cLength = 16;
Note Make sure that the credit-card mask for your Other Card number does not exceed 20 digits (not including spaces).
Modify the following string to identify the cards being installed as a group:
// MOD TODO: The following string is used to identify the cards being installed as a group. If there is a single name then this should reflect the TYPE.
//
static const OLECHAR* wszAcceptName = L"Microsoft Cards";
You can modify the following string to reflect the name of the company or organization that creates the card:
// MOD TODO: The following string reflects the entity creating the card
//
static const OLECHAR* wszSource = L"Microsoft";
// MOD TODO: This structure just make it easier to grab the above definitions it should reflect the cMaxCards size. Comment out any extra cards.
//
static const CardDescription gCards[cMaxCards] = {
{szMSName,szMSFName},
{szMSGName,szMSGFName}
};
Load the bitmaps for your card by changing the following section. In this example, each card uses two bitmaps: a large and a small representation of the card:
// MOD TODO: Load the bitmaps into memory and hold onto them
// until the object is destroyed.
//
COtherCardObject::COtherCardObject()
{
if (dwBitRefCnt++ == 0) {
hSBitmap = Load256Bitmap(IDB_SMMSCRD);
hLBitmap = Load256Bitmap(IDB_MSCARD);
hSGBitmap = Load256Bitmap(IDB_SMMSGCRD);
hLGBitmap = Load256Bitmap(IDB_MSGOLDCARD);
}
}
Provide card number validation by changing the following section (the code is too long for this document, see the following header in MyCard.cpp):
// MOD TODO: Edit this routine to validate your specific card numbers.
// Note: If you have no validation checks, just return S_OK.
//
This is the module definition file created by the ATL Wizard. Change the following line to match the name of your Other Card DLL:
;MOD TODO: Change "OtherCard.DLL" to "<YourCardName>.DLL"
LIBRARY "OTHERCARD.DLL"
This is the Microsoft® Visual C++® makefile for the sample Other Card project. It is recommended that you let Developer Studio™ create a makefile for you by creating a new Developer Studio project workspace (see the section "Using Visual C++"). This file requires no changes.
This is the resource file used by your Other Card component. Change the following line to match the name of your Other Card DLL:
// MOD TODO Change this occurrence of 1 TYPELIB ""OtherCard.tlb""\r\n" to
// 1 TYPELIB ""<YourCardName>.tlb""\r\n"
//
"1 TYPELIB ""Othercard.tlb""\r\n"
You can also change the following lines to customize the version information in your Other Card DLL:
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Microsoft Corporation\0"
VALUE "FileDescription", "OtherCard Module\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "OTHERCARD\0"
VALUE "LegalCopyright", "Copyright © 1995\0"
VALUE "OriginalFilename", "OTHERCARD.DLL\0"
VALUE "ProductName", "Example Credit Card Extension\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
END
This .idl file defines the Other Card object. It is read by the MIDL compiler, which generates the type libraries. You must create two new globally unique identifiers (GUIDs) and insert them at the following locations:
// MOD TODO: Change three occurrences of VCCard to <YourCardName>
// MOD TODO: you need to replace the following two uuid's with new
// generated uuid's. These are used to identify your object and
// typelib.
[
uuid(130AF030-E8B9-11d0-BB16-00AA00A13794),
version(1.0),
helpstring("VCCard 1.0 Type Library")
]
// MOD TODO: Change VCCardLib to <YourCardName>Lib
library VCCardLib
{
importlib("stdole32.tlb");
[
uuid(130AF031-E8B9-11d0-BB16-00AA00A13794),
helpstring("VCCard Class")
]
coclass VCCard
{
[default] interface ICreditCardOtherCard;
interface IPaymentCCTypeInstall;
};
};
Because comments are not allowed in the .rgs file, you'll find no MOD TODO comments. However, you must change the GUID specified in that file to the coclass GUID (the second GUID) that you specified in your OtherCard.idl file. Additionally, change all references to VCCard to <YourCardName>.
{
VCCard.VCCard.1 = s 'VCCard Class'
{
CLSID = s '{130AF031-E8B9-11d0-BB16-00AA00A13794}'
}
VCCard.VCCard = s 'VCCard Class'
{
CurVer = s 'VCCard.VCCard.1'
}
NoRemove CLSID
{
ForceRemove {130AF031-E8B9-11d0-BB16-00AA00A13794} = s 'VCCard Class'
{
ProgID = s 'VCCard.VCCard.1'
VersionIndependentProgID = s 'VCCard.VCCard'
ForceRemove 'Programmable'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
}
}
}
This source file implements a generic registry class that controls registration with the Payment Selector. This file requires no changes.