home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / code / vbcode.md_ / vbcode.md / VB-Code.json
Encoding:
JavaScript Object Notation  |  1996-03-30  |  4.5 KB

  1. {
  2.     "schema": {
  3.         "Code Name": "Text (50)",
  4.         "Declerations": "Memo/Hyperlink (255)",
  5.         "Code": "Memo/Hyperlink (255)",
  6.         "Description": "Memo/Hyperlink (255)"
  7.     },
  8.     "data": [
  9.         {
  10.             "Code Name": "Database Add Record",
  11.             "Code": "Data1.Recordset.AddNew",
  12.             "Description": "Allows the user to add a new record"
  13.         },
  14.         {
  15.             "Code Name": "Database Save Record",
  16.             "Code": "Data1.Recordset.Update"
  17.         },
  18.         {
  19.             "Code Name": "Database Delete Record",
  20.             "Code": "Data1.Recordset.Delete:   Data1.Recordset.MoveNext"
  21.         },
  22.         {
  23.             "Code Name": "Cut",
  24.             "Code": "Clipboard.Clear:  Clipboard.SetText Screen.ActiveControl.SelText: Screen.ActiveControl.SelText = \"\""
  25.         },
  26.         {
  27.             "Code Name": "Copy",
  28.             "Code": "Clipboard.Clear:  Clipboard.SetText Screen.ActiveControl.SelText"
  29.         },
  30.         {
  31.             "Code Name": "Load a Shell Program",
  32.             "Code": "Dim H%:  H% = Shell(\"winhelp.exe vbcode.hlp\", 1)"
  33.         },
  34.         {
  35.             "Code Name": "Button Bar Cases",
  36.             "Code": "Select Case Button   Case 0: mnuNew_Click\r\n   Case 1: mnuSave_Click\r\n   Case 2: mnuCut_Click\r\n   Case 3: mnuCopy_Click\r\n   Case 4: mnuPaste_Click\r\n   Case 5: mnuNew_Click\r\n   Case 6: mnuDelete_Click\r\n   Case 7: mnuContents_Click\r\n   End Select"
  37.         },
  38.         {
  39.             "Code Name": "To Play WAV Files",
  40.             "Declerations": "Declare function sndPlaySound Lib \"MMSYSTEM\" (byval lpWavName$, byval Flags%) as Integer\r\n",
  41.             "Code": "dim x% x% = sndPlaySound(\"C:\\win31\\tada.Wav\", 1)"
  42.         },
  43.         {
  44.             "Code Name": "Printer Setup",
  45.             "Declerations": "Global di%\r\nDeclare Function GetProfileString% Lib \"Kernel\" (ByVal lpAppName$, ByVal lpKeyName As Any, ByVal lpDefault$, ByVal lpReturnedString$, ByVal nSize%)\r\nDeclare Function LoadLibrary% Lib \"Kernel\" (ByVal lpLibFileName$)\r\nDeclare Sub FreeLibrary Lib \"Kernel\" (ByVal hLibModule%)\r\nDeclare Function agGetStringFromLPSTR$ Lib \"\"Apiguide.dll\"\" (ByVal lpstring$)\r\nDeclare Function agDeviceMode% Lib \"\"Apiguide.dll\"\" (ByVal hWnd%, ByVal hModule%, ByVal lpszDevice$, ByVal lpszOutput$)\r\n\r\nFunction GetDefPrinter$ ()\r\n\r\nDim def$\r\ndef$ = String$(128, 0)\r\ndi% = GetProfileString%(\"\"WINDOWS\"\", \"\"DEVICE\"\", \"\"\"\", def$, 127)\r\ndef$ = agGetStringFromLPSTR$(def$)\r\nGetDefPrinter$ = def$\r\n\r\nEnd Function\r\nFunction GetDeviceDriver$ (dev$)\r\n\r\nDim firstpos%, nextpos%\r\nfirstpos% = InStr(dev$, \"\",\"\")\r\nnextpos% = InStr(firstpos% + 1, dev$, \"\",\"\")\r\nGetDeviceDriver$ = Mid$(dev$, firstpos% + 1, nextpos% - firstpos% - 1)\r\n\r\nEnd Function\r\nFunction GetDeviceName$ (dev$)\r\n\r\nDim npos%\r\nnpos% = InStr(dev$, \"\",\"\")\r\nGetDeviceName$ = Left$(dev$, npos% - 1)\r\n\r\nEnd Function\r\nFunction GetDeviceOutput$ (dev$)\r\n\r\nDim firstpos%, nextpos%\r\nfirstpos% = InStr(dev$, \"\",\"\")\r\nnextpos% = InStr(firstpos% + 1, dev$, \"\",\"\")\r\nGetDeviceOutput$ = Mid$(dev$, nextpos% + 1)\r\n\r\nEnd Function\r\n\"",
  46.             "Code": "Dim dev$, devname$, devoutput$  Dim libhnd%   dev$ = GetDefPrinter$() ' Get default printer info\r\n        If dev$ = \"\" Then Exit Sub      devname$ = GetDeviceName$(dev$)\r\n        devoutput$ = GetDeviceOutput$(dev$)\r\n        ' Load the device driver library - exit if unavailable\r\n        libhnd% = LoadLibrary(GetDeviceDriver$(dev$) + \"\".drv\"\")\r\n        If libhnd% = 0 Then Exit Sub\r\n        ' WARNING - this allows change of the default printer\r\n        ' settings!\r\n        di% = agDeviceMode(hWnd, libhnd%, devname$, devoutput$)\r\n        FreeLibrary (libhnd%)"
  47.         },
  48.         {
  49.             "Code Name": "Database WAV file playing",
  50.             "Declerations": "Declare function sndPlaySound Lib \"MMSYSTEM\" (byval lpWavName$, byval Flags%) as Integer\r\n",
  51.             "Code": "Dim x% x% = sndPlaySound(text1, 1)"
  52.         },
  53.         {
  54.             "Code Name": "Sound Playing WAV and MIDI",
  55.             "Declerations": "Declare Function mciExecute Lib \"MMSystem\" (ByVal FileName As String) As Integer\r\n",
  56.             "Code": "iResult = mciExecute(\"Play c:\\sound\\midi\\yearocat.mid\")"
  57.         },
  58.         {
  59.             "Code Name": "Dial a Phone Number",
  60.             "Code": "PhoneNumber$ = \"(123) 456-7890\"\r\nOpen \"COM2\" For Output As #1   'or COM1\r\nPrint #1, \"ATDT\" & PhoneNumber$ & Chr$(13)\r\nClose #1\r\n\r\n"
  61.         },
  62.         {
  63.             "Code Name": "Moving Text",
  64.             "Declerations": "Option Explicit\r\nDim Deltax, Deltay As Integer\r\n",
  65.             "Code": "'TIMER CODE Sub Timer1_Timer ()\r\nPicture1.Move Picture1.Left + Deltax, Picture1.Top + Deltay\r\n\r\nIf Picture1.Left < ScaleLeft Then Deltax = 100\r\nIf Picture1.Left + Picture1.Width > ScaleWidth + ScaleLeft Then Deltax = -100\r\n'End If\r\n\r\nIf Picture1.Top < ScaleTop Then Deltay = 100\r\nIf Picture1.Top + Picture1.Height > ScaleHeight + ScaleTop Then Deltay = -100\r\n'End If\r\nEnd Sub\r\n\r\n\r\n'FORM LOAD\r\nSub Form_Load ()\r\nDeltax = 100\r\nDeltay = 100\r\nEnd Sub"
  66.         },
  67.         {
  68.             "Code Name": "Sounds System Beep",
  69.             "Code": "For I = 1 To 3  ' Loop 3 times.\r\nBeep    ' Sound a tone.\r\nNext I\r\nEnd Sub\r\n"
  70.         }
  71.     ]
  72. }