home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / Libraries / Digital Money™ Dev Kit / DM Development / sample dmi init.c < prev   
Encoding:
Text File  |  1995-04-11  |  4.8 KB  |  131 lines  |  [TEXT/KAHL]

  1. // *******************************************************************
  2. // Copyright 1995 Digital Money, Inc.
  3. // You may use this source code in your own applications.
  4. //
  5. // This is a sample Digital Money Control Block (DMCB) initialization
  6. // for use in version 4.8 of the Digital Money AutoPay software.
  7. // See AutoPay manual for more information.
  8. // This code released April 5, 1995.
  9. // *******************************************************************
  10.  
  11.  
  12. #include     "DMIdeveloper.h.c"
  13.  
  14. void initDigitalMoney (digiMonBlock *myDMCB)
  15. {
  16.     short        i;
  17.     
  18.     // General settings
  19.     
  20.     strcpy(myDMCB->programName,"Guy Friday 1.22");
  21.     myDMCB->returnSerialNum=1;                         // 1=true; 0=false
  22.     myDMCB->areAdditionalItemsForSale=1;            // 1=true; 0=false
  23.     strcpy(myDMCB->programPassword,"cecil");
  24.     strcpy(myDMCB->programID,"100");
  25.     strcpy(myDMCB->programSource,"AOL");
  26.     
  27.  
  28.     // Security
  29.     
  30.     // This is a secret string of ascii characters used for encryption.
  31.     // You should keep this key confidential, even among your own employees.
  32.     // The string is comprised of visible ASCII characters - i.e. don't
  33.     // use control characters. But punctuation is okay.
  34.     
  35.     strcpy(myDMCB->encodeMeth,"GuyFridayEncodeMeth2");
  36.  
  37.     // Screen Text
  38.     
  39.     // You can alter the text that appears on the top of each dialog box displayed
  40.     // by Digital Money. Normally, Digital Money reads "styled text" resources
  41.     // from your resource file, but if you want to change the text on the fly, so
  42.     // to speak, you can just pass a pointer leading to the appropriate
  43.     // text and style handle. Note that you must first initialize all 10 text pointers
  44.     // to zero so that Digital Money can tell the difference between a zero pointer
  45.     // (i.e. you don't want to replace the default text in the resource file) and a
  46.     // non-zero pointer (you *do* want to change the text). See below for an example.
  47.     
  48.     for (i=0; i<=9; i++)
  49.     {
  50.         myDMCB->screenText[i]=0;
  51.     }
  52.     
  53.     // Next be sure to allocate memory for any pointer that you want Digital Money
  54.     // to use. For instance, to change the text that appears on the opening screen,
  55.     // set the screenText[0] pointer, like this:
  56.     
  57.  
  58.     
  59.     // ...for a complete list of which array item corresponds to which dialog,
  60.     // see printed docs.
  61.     
  62.     // The users name
  63.     
  64.     // If you already know the users name for some reason, you should send it
  65.     // to the DM Module, so that DM doesn't have to ask the user for it. If you
  66.     // don't know it, then **be sure** to set the usersName string to null. In
  67.     // any case, if the user successfully completes enough of the DM transaction,
  68.     // his name will be returned to you in this string, should you want to use it,
  69.     // for registration splash screens or whatever.
  70.     
  71.     strcpy(myDMCB->usersName,"");     // I don't know it, so it to null!
  72.     
  73.     // Your Product Catalog
  74.     
  75.     myDMCB->numItemsInCatalog=2;
  76.  
  77.      // first, initialize pointers for each item in catalog
  78.      
  79.      for (i=0; i<=myDMCB->numItemsInCatalog-1; i++)    // notice first item is item #0
  80.      {
  81.          myDMCB->catalogItem[i]=(catalogItemType *)NewPtr(sizeof(catalogItemType));
  82.      }
  83.      
  84.      strcpy(myDMCB->catalogItem[0]->name,"Register Guy Friday 1.2");
  85.     strcpy(myDMCB->catalogItem[0]->prodCode,"910001");
  86.     myDMCB->catalogItem[0]->minPurchase=1;
  87.     myDMCB->catalogItem[0]->maxPurchase=1;
  88.     myDMCB->catalogItem[0]->price=24.00;
  89.     myDMCB->catalogItem[0]->numVarCodes=0;
  90.     myDMCB->catalogItem[0]->shUSA=0;
  91.     myDMCB->catalogItem[0]->shFOR=0;
  92.     
  93.      strcpy(myDMCB->catalogItem[1]->name,"Digital Money tee-shirt");
  94.     strcpy(myDMCB->catalogItem[1]->prodCode,"710002");
  95.     myDMCB->catalogItem[1]->minPurchase=1;
  96.     myDMCB->catalogItem[1]->maxPurchase=10;
  97.     myDMCB->catalogItem[1]->price=15;
  98.     myDMCB->catalogItem[1]->numVarCodes=2;
  99.     strcpy(myDMCB->catalogItem[1]->varCode1,"LARGE");
  100.     strcpy(myDMCB->catalogItem[1]->varCode2,"X-LARGE");
  101.     myDMCB->catalogItem[1]->shUSA=3;
  102.     myDMCB->catalogItem[1]->shFOR=7;
  103.     
  104.     
  105.     // preselect items to be purchased
  106.     // explanation: when the Digital Money module takes control of
  107.     // the user interface, what items do you want to be preselected 
  108.     // for purchase by the user? If nothing, then set the following to 0.
  109.  
  110.     myDMCB->numItemsPrepurchased=1;
  111.     
  112.     // Notice how the description of the preselected item precisely matches
  113.     // the associated item in the product catalog. Please be careful and do
  114.     // the same!
  115.     
  116.     // The only exception is the "editable" flag, which can be set to false
  117.     // on a pre-selected item, even if the catalog doesn't match this. This 
  118.     // means the user won't be able to remove or edit this preselected item.
  119.     
  120.     strcpy(myDMCB->prepurchaseItem[0].name,"Register Guy Friday 1.2");
  121.     strcpy(myDMCB->prepurchaseItem[0].prodCode,"910001");
  122.     strcpy(myDMCB->prepurchaseItem[0].varCode,"");
  123.     myDMCB->prepurchaseItem[0].price=24.00;
  124.     myDMCB->prepurchaseItem[0].quantity=1;
  125.     myDMCB->prepurchaseItem[0].editable=1;            // 1=true; 0=false
  126.     myDMCB->prepurchaseItem[0].minPurchase=1;
  127.     myDMCB->prepurchaseItem[0].maxPurchase=1;
  128.     myDMCB->prepurchaseItem[0].shUSA=0;
  129.     myDMCB->prepurchaseItem[0].shFOR=0;
  130.     
  131. }