home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1995 September / Image.iso / pcplus / handson / vbwrk107 / apimmain.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-06-09  |  21.2 KB  |  675 lines

  1. VERSION 2.00
  2. Begin Form APIMAGIC 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "API Magic"
  6.    ClientHeight    =   5868
  7.    ClientLeft      =   1392
  8.    ClientTop       =   1944
  9.    ClientWidth     =   7572
  10.    ClipControls    =   0   'False
  11.    Height          =   6612
  12.    Icon            =   APIMMAIN.FRX:0000
  13.    Left            =   1344
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    ScaleHeight     =   5868
  17.    ScaleWidth      =   7572
  18.    Top             =   1248
  19.    Width           =   7668
  20.    Begin PictureBox Busy_Flash 
  21.       BackColor       =   &H00800000&
  22.       ClipControls    =   0   'False
  23.       Height          =   825
  24.       Left            =   540
  25.       ScaleHeight     =   804
  26.       ScaleWidth      =   3684
  27.       TabIndex        =   20
  28.       Top             =   2430
  29.       Visible         =   0   'False
  30.       Width           =   3705
  31.       Begin Label Label1 
  32.          Alignment       =   2  'Center
  33.          BackStyle       =   0  'Transparent
  34.          Caption         =   "Loading Data...."
  35.          ForeColor       =   &H00000000&
  36.          Height          =   195
  37.          Left            =   180
  38.          TabIndex        =   21
  39.          Top             =   270
  40.          Width           =   3255
  41.       End
  42.       Begin Shape Shape1 
  43.          BorderColor     =   &H0080FFFF&
  44.          BorderStyle     =   0  'Transparent
  45.          FillColor       =   &H0080FFFF&
  46.          FillStyle       =   0  'Solid
  47.          Height          =   645
  48.          Left            =   90
  49.          Top             =   90
  50.          Width           =   3525
  51.       End
  52.    End
  53.    Begin PictureBox AniPic 
  54.       AutoRedraw      =   -1  'True
  55.       AutoSize        =   -1  'True
  56.       BorderStyle     =   0  'None
  57.       Height          =   384
  58.       Index           =   0
  59.       Left            =   4860
  60.       Picture         =   APIMMAIN.FRX:0302
  61.       ScaleHeight     =   32
  62.       ScaleMode       =   3  'Pixel
  63.       ScaleWidth      =   32
  64.       TabIndex        =   18
  65.       Top             =   5940
  66.       Visible         =   0   'False
  67.       Width           =   384
  68.    End
  69.    Begin PictureBox AniPic 
  70.       AutoRedraw      =   -1  'True
  71.       AutoSize        =   -1  'True
  72.       BorderStyle     =   0  'None
  73.       Height          =   384
  74.       Index           =   1
  75.       Left            =   5490
  76.       Picture         =   APIMMAIN.FRX:0604
  77.       ScaleHeight     =   32
  78.       ScaleMode       =   3  'Pixel
  79.       ScaleWidth      =   32
  80.       TabIndex        =   17
  81.       Top             =   5940
  82.       Visible         =   0   'False
  83.       Width           =   384
  84.    End
  85.    Begin Timer AniTimer 
  86.       Enabled         =   0   'False
  87.       Interval        =   100
  88.       Left            =   4320
  89.       Top             =   6030
  90.    End
  91.    Begin SSFrame Frame3D5 
  92.       Font3D          =   3  'Inset w/light shading
  93.       Height          =   1905
  94.       Left            =   180
  95.       ShadowStyle     =   1  'Raised
  96.       TabIndex        =   15
  97.       Top             =   3780
  98.       Width           =   7215
  99.       Begin PictureBox mask 
  100.          BackColor       =   &H00C0C0C0&
  101.          BorderStyle     =   0  'None
  102.          Enabled         =   0   'False
  103.          Height          =   285
  104.          Left            =   6885
  105.          ScaleHeight     =   288
  106.          ScaleWidth      =   288
  107.          TabIndex        =   16
  108.          TabStop         =   0   'False
  109.          Top             =   1575
  110.          Width           =   285
  111.       End
  112.       Begin TextBox txtOutput 
  113.          ForeColor       =   &H00000000&
  114.          Height          =   1635
  115.          Left            =   90
  116.          MultiLine       =   -1  'True
  117.          ScrollBars      =   3  'Both
  118.          TabIndex        =   2
  119.          Top             =   180
  120.          Width           =   7035
  121.       End
  122.    End
  123.    Begin SSFrame Frame3D4 
  124.       Font3D          =   3  'Inset w/light shading
  125.       Height          =   1635
  126.       Left            =   165
  127.       ShadowStyle     =   1  'Raised
  128.       TabIndex        =   14
  129.       Top             =   1995
  130.       Width           =   4440
  131.       Begin ListBox lbSelect 
  132.          ForeColor       =   &H00000000&
  133.          Height          =   1368
  134.          Left            =   75
  135.          TabIndex        =   1
  136.          Top             =   165
  137.          Width           =   4248
  138.       End
  139.    End
  140.    Begin SSFrame Frame3D3 
  141.       Font3D          =   3  'Inset w/light shading
  142.       Height          =   1635
  143.       Left            =   4860
  144.       ShadowStyle     =   1  'Raised
  145.       TabIndex        =   13
  146.       Top             =   1980
  147.       Width           =   2535
  148.       Begin PictureBox Logo 
  149.          AutoSize        =   -1  'True
  150.          ClipControls    =   0   'False
  151.          ForeColor       =   &H00000000&
  152.          Height          =   408
  153.          Left            =   1620
  154.          MousePointer    =   4  'Icon
  155.          Picture         =   APIMMAIN.FRX:0906
  156.          ScaleHeight     =   32
  157.          ScaleMode       =   3  'Pixel
  158.          ScaleWidth      =   32
  159.          TabIndex        =   19
  160.          TabStop         =   0   'False
  161.          Top             =   270
  162.          Width           =   408
  163.       End
  164.       Begin SSCommand btn3DClear 
  165.          Caption         =   "&Clear"
  166.          Font3D          =   3  'Inset w/light shading
  167.          ForeColor       =   &H00000000&
  168.          Height          =   465
  169.          Left            =   180
  170.          TabIndex        =   7
  171.          Top             =   270
  172.          Width           =   915
  173.       End
  174.       Begin SSCommand btn3DExport 
  175.          Caption         =   "&Export"
  176.          Enabled         =   0   'False
  177.          Font3D          =   3  'Inset w/light shading
  178.          ForeColor       =   &H00000000&
  179.          Height          =   465
  180.          Left            =   180
  181.          TabIndex        =   8
  182.          Top             =   990
  183.          Width           =   915
  184.       End
  185.       Begin SSCommand btn3DExit 
  186.          Caption         =   "E&xit"
  187.          Font3D          =   3  'Inset w/light shading
  188.          ForeColor       =   &H00000000&
  189.          Height          =   465
  190.          Left            =   1440
  191.          TabIndex        =   9
  192.          Top             =   990
  193.          Width           =   915
  194.       End
  195.    End
  196.    Begin SSFrame Frame3D2 
  197.       Caption         =   "Display"
  198.       Font3D          =   3  'Inset w/light shading
  199.       ForeColor       =   &H00000000&
  200.       Height          =   1635
  201.       Left            =   4860
  202.       ShadowStyle     =   1  'Raised
  203.       TabIndex        =   12
  204.       Top             =   180
  205.       Width           =   2535
  206.       Begin SSOption OptVBConst 
  207.          Caption         =   "VB  Constants"
  208.          Font3D          =   3  'Inset w/light shading
  209.          ForeColor       =   &H00000000&
  210.          Height          =   285
  211.          Left            =   270
  212.          TabIndex        =   6
  213.          TabStop         =   0   'False
  214.          Top             =   1170
  215.          Width           =   2085
  216.       End
  217.       Begin SSOption OptAPIDecs 
  218.          Caption         =   "API Declarations"
  219.          Font3D          =   3  'Inset w/light shading
  220.          ForeColor       =   &H00000000&
  221.          Height          =   285
  222.          Left            =   270
  223.          TabIndex        =   3
  224.          Top             =   360
  225.          Width           =   2085
  226.       End
  227.       Begin SSOption OptAPIConst 
  228.          Caption         =   "API Constants"
  229.          Font3D          =   3  'Inset w/light shading
  230.          ForeColor       =   &H00000000&
  231.          Height          =   285
  232.          Left            =   270
  233.          TabIndex        =   4
  234.          TabStop         =   0   'False
  235.          Top             =   630
  236.          Width           =   2085
  237.       End
  238.       Begin SSOption OptAPIStruct 
  239.          Caption         =   "API Structures"
  240.          Font3D          =   3  'Inset w/light shading
  241.          ForeColor       =   &H00000000&
  242.          Height          =   285
  243.          Left            =   270
  244.          TabIndex        =   5
  245.          TabStop         =   0   'False
  246.          Top             =   900
  247.          Width           =   2085
  248.       End
  249.    End
  250.    Begin SSFrame Frame3D1 
  251.       Caption         =   "Search"
  252.       Font3D          =   3  'Inset w/light shading
  253.       ForeColor       =   &H00000000&
  254.       Height          =   1635
  255.       Left            =   180
  256.       ShadowStyle     =   1  'Raised
  257.       TabIndex        =   10
  258.       Top             =   180
  259.       Width           =   4425
  260.       Begin TextBox txtSearch 
  261.          BackColor       =   &H00FFFF00&
  262.          ForeColor       =   &H00000000&
  263.          Height          =   285
  264.          Left            =   180
  265.          TabIndex        =   0
  266.          Top             =   360
  267.          Width           =   4065
  268.       End
  269.       Begin CommandButton btnAlpha 
  270.          BackColor       =   &H00C0C0C0&
  271.          Caption         =   "A"
  272.          Height          =   285
  273.          Index           =   0
  274.          Left            =   360
  275.          TabIndex        =   11
  276.          TabStop         =   0   'False
  277.          Top             =   810
  278.          Width           =   285
  279.       End
  280.    End
  281.    Begin Menu mnuHelp 
  282.       Caption         =   "&Help"
  283.       Begin Menu mnuHelpContents 
  284.          Caption         =   "&Contents"
  285.       End
  286.       Begin Menu sep1 
  287.          Caption         =   "-"
  288.       End
  289.       Begin Menu mnuHelpAbout 
  290.          Caption         =   "&About"
  291.       End
  292.    End
  293. Option Explicit
  294. 'create form level variables/constants
  295. Dim DB As Database          'database object
  296. Dim DTbl As Table           'table object
  297. Dim anistate As Integer     'animate logo true/false
  298. Dim BMark() As Variant      'dynamic array to hold bookmarks
  299. Dim CRLF As String * 2      'carriage return/linefeed pair
  300. Dim result As Integer       'return value from API calls
  301. Dim user_choice As Integer  'last user selection
  302. Const DB_READONLY = 4       'database read only option
  303. 'cursor keys
  304. Const KEY_CUR_DOWN = &H28   'cursor down
  305. Const KEY_CUR_UP = &H26     'cursor up
  306. Sub Animate ()
  307. 'this routine animates the APIMAGIC icons
  308. Static state As Integer 'animation state record
  309. 'toggle animation state on each call
  310. state = state Xor 1
  311. 'animate icon if application minimised
  312. If APIMAGIC.WindowState = MINIMIZED Then
  313.     'animate icon
  314.     result = BitBlt(APIMAGIC.hDC, 2, 2, 32, 32, AniPic(state).hDC, 0, 0, SRCCOPY)
  315.     'otherwise animate logo on main window
  316.     result = BitBlt(Logo.hDC, 0, 0, 32, 32, AniPic(state).hDC, 0, 0, SRCCOPY)
  317.     'if About... screen loaded - animate it's logos
  318.     If AboutLoaded Then
  319.         result = BitBlt(APIMLOGO!Logo1.hDC, 0, 0, 32, 32, AniPic(state).hDC, 0, 0, SRCCOPY)
  320.         result = BitBlt(APIMLOGO!Logo2.hDC, 0, 0, 32, 32, AniPic(state).hDC, 0, 0, SRCCOPY)
  321.     End If
  322. End If
  323. End Sub
  324. Sub AniTimer_Timer ()
  325. 'call icon animation subroutine
  326. Animate
  327. End Sub
  328. Sub btn3DClear_Click ()
  329. 'reset select/search box
  330. lbSelect.ListIndex = 0
  331. txtSearch.SetFocus
  332. 'erase the output textbox
  333. txtOutput = ""
  334. End Sub
  335. Sub btn3DExit_Click ()
  336. 'trigger program end
  337. Unload Me
  338. End Sub
  339. Sub btn3DExport_Click ()
  340. Dim VBCode As String        'text to be exported
  341. Dim MBD_MsgText As String   'text in message box
  342. 'prepare export text
  343. VBCode = txtOutput
  344. If Right(VBCode, 2) <> CRLF Then VBCode = VBCode & CRLF
  345. 'place data onto clipboard
  346. Clipboard.Clear
  347. Clipboard.SetText txtOutput & CRLF
  348. 'return select box to last selected item
  349. Reset_SelectBox
  350. 'switch to VB - if VB not running then skip
  351. 'the rest of this event
  352. result = FindWindowByTitle(0&, "Microsoft Visual Basic")
  353. If result = 0 Then Exit Sub
  354. result = ShowWindow(result, SW_SHOWNOACTIVATE)
  355. AppActivate "Microsoft Visual Basic"
  356. DoEvents
  357. 'paste clipboard contents into VB code window if
  358. 'not running in design environment
  359. If App.EXEName = "APIM" Then
  360.     MBD_MsgText = "Cannot export code into my own executing source code. Code placed on clipboard only."
  361.     MsgBox MBD_MsgText, 48, "API MAGIC Reality Error"
  362.     Exit Sub
  363.     SendKeys "%EP", True
  364. End If
  365. End Sub
  366. Sub btnAlpha_Click (Index As Integer)
  367. 'clear any search string
  368. txtSearch = ""
  369. 'find next entry in select box starting with button legend
  370. result = SendMessageByString(lbSelect.hWnd, LB_FINDSTRING, lbSelect.ListIndex, btnAlpha(Index).Caption)
  371. 'if match found then position it at the top of
  372. 'the select box
  373. If result > -1 Then
  374.     lbSelect.ListIndex = result
  375.     result = SendMessageByNum(lbSelect.hWnd, LB_SETTOPINDEX, result, 0&)
  376. End If
  377. txtSearch.SetFocus
  378. End Sub
  379. Sub Form_Load ()
  380. Dim i As Integer            'general loop counter
  381. Dim x As Integer            'positioning value for alpha buttons
  382. Dim y As Integer            'positioning value for alpha buttons
  383. Dim db_name As String       'path and name of database
  384. Dim MBD_MsgText As String   'message box text
  385. 'allow only one copy of API MAGIC to run
  386. 'switch to previous instance if it exists
  387. If App.PrevInstance Then
  388.     Dim SaveTitle As String
  389.     SaveTitle = App.Title
  390.     App.Title = "... duplicate instance."
  391.     APIMAGIC.Caption = "... duplicate instance."
  392.     AppActivate SaveTitle
  393.     SendKeys "% R", True
  394.     End
  395. End If
  396. 'build path and filename of database file
  397. db_name = App.Path
  398. If Right(db_name, 1) <> "\" Then db_name = db_name & "\"
  399. db_name = db_name & "APIMAGIC.MDB"
  400. 'check we have a database
  401. If Len(Dir(db_name)) = 0 Then
  402.     MBD_MsgText = "Unable to locate database file:" & Chr$(10) & db_name
  403.     MsgBox MBD_MsgText, 16
  404.     End
  405. End If
  406. '***** Loading the form APIMBtn will add a button
  407. '***** to Visual BASIC's toolbar *if* Visual BASIC is
  408. '***** currently loaded. Clicking on this new button
  409. '***** will bring API Magic to the fore - even if
  410. '***** currently minimised. See file _README.TXT
  411. If Command$ = "" Then
  412.     Load APIMBtn
  413. End If
  414. 'define carriage return/linefeed pair
  415. CRLF = Chr$(13) & Chr$(10)
  416. 'display logo screen
  417. APIMLOGO.Show
  418. APIMLOGO.Refresh
  419. 'indicate busy while initialising
  420. Screen.MousePointer = HOURGLASS
  421. 'load and position 13 alpha buttons (A-N)
  422. x = btnAlpha(0).Left
  423. y = btnAlpha(0).Top
  424. For i = 1 To 12
  425.     Load btnAlpha(i)
  426.     x = x + btnAlpha(0).Width
  427.     btnAlpha(i).Move x, y
  428.     btnAlpha(i).Caption = Chr$(i + 65)
  429.     btnAlpha(i).Visible = True
  430. 'load and position 13 alpha buttons (M-Z)
  431. x = btnAlpha(0).Left
  432. y = y + btnAlpha(0).Height
  433. For i = 13 To 25
  434.     Load btnAlpha(i)
  435.     btnAlpha(i).Move x, y
  436.     btnAlpha(i).Caption = Chr$(i + 65)
  437.     x = x + btnAlpha(0).Width
  438.     btnAlpha(i).Visible = True
  439. 'open the database
  440. Set DB = OpenDatabase(db_name, True, True)
  441. 'display main screen
  442. Center_Form Me
  443. Me.Show
  444. 'switch on icon animation
  445. anistate = True
  446. DoEvents
  447. 'clear logo screen
  448. Unload APIMLOGO
  449. 'load declarations
  450. OptAPIDecs = 1
  451. End Sub
  452. Sub Form_Unload (Cancel As Integer)
  453. Dim i As Integer
  454. 'close table
  455. DTbl.Close
  456. Set DTbl = Nothing
  457. 'close the database
  458. DB.Close
  459. Set DB = Nothing
  460. 'release help file if open
  461. result = WinHelp(Me.hWnd, App.HelpFile, HELP_QUIT, 0&)
  462. 'unload VB toolbar button
  463. Unload APIMBtn
  464. 'unload alpha buttons
  465. For i = 1 To 25
  466.     Unload btnAlpha(i)
  467. 'double check logo screen no longer loaded
  468. If AboutLoaded Then Unload APIMLOGO
  469. 'tidy up
  470. AniTimer.Enabled = False
  471. Erase BMark
  472. End Sub
  473. Sub lbSelect_DblClick ()
  474. Dim outstr As String
  475. 'build data for transfer to output textbox
  476. DTbl.Bookmark = BMark(lbSelect.ListIndex)
  477. Select Case user_choice
  478.     Case 0
  479.     'declarations
  480.         If Left(DTbl("Entry"), 1) Like "[%&]" Then
  481.             outstr = "Declare Function "
  482.         Else
  483.             outstr = "Declare Sub "
  484.         End If
  485.         outstr = outstr & DTbl("Caption") & DTbl("Entry")
  486.     Case 2
  487.     'structures
  488.         outstr = CRLF & "Type " & DTbl("Caption") & CRLF & DTbl("Entry") & "End Type" & CRLF
  489.     Case Else
  490.     'constants
  491.         outstr = "Global Const " & DTbl("Caption") & DTbl("Entry")
  492. End Select
  493. 'do not transfer data if it already exists
  494. 'in the output textbox
  495. If InStr(txtOutput, outstr) Then
  496.     txtSearch.SetFocus
  497.     Exit Sub
  498. End If
  499. 'transfer data to output textbox
  500. 'add a cr/lf if not the first entry
  501. If txtOutput > "" Then
  502.     txtOutput = txtOutput & CRLF & outstr
  503.     txtOutput = outstr
  504. End If
  505. 'scroll to last entry in output box
  506. result = SendMessageByNum(txtOutput.hWnd, EM_GETLINECOUNT, 0, 0&)
  507. result = SendMessageByNum(txtOutput.hWnd, EM_LINEINDEX, result - 1, 0&)
  508. txtOutput.SelStart = result
  509. txtSearch.SetFocus
  510. End Sub
  511. Sub lbSelect_GotFocus ()
  512. txtSearch.SetFocus
  513. End Sub
  514. Sub lbSelect_KeyPress (KeyAscii As Integer)
  515. 'equate pressing [Enter] key to a double click
  516. If KeyAscii = 13 Then lbSelect_DblClick
  517. End Sub
  518. Sub Logo_Click ()
  519. 'toggle animation on/off with each click
  520. AniTimer.Enabled = Not AniTimer.Enabled
  521. anistate = Not anistate
  522. txtSearch.SetFocus
  523. End Sub
  524. Sub mnuHelpAbout_Click ()
  525. 'display logo screen with OK button enabled
  526. APIMLOGO.btnOK.Visible = True
  527. APIMLOGO.Show 1
  528. End Sub
  529. Sub mnuHelpContents_Click ()
  530. 'display application help file contents
  531. result = WinHelp(Me.hWnd, App.HelpFile, HELP_INDEX, "")
  532. End Sub
  533. Sub Open_Table (BTable As String, Idx As String)
  534. 'close any open tables
  535. If Not (DTbl Is Nothing) Then DTbl.Close
  536. 'open database table in read only mode
  537. Set DTbl = DB.OpenTable(BTable, DB_READONLY)
  538. 'use primary index
  539. DTbl.Index = Idx
  540. End Sub
  541. Sub OptAPIConst_Click (Value As Integer)
  542. 'open table of API Constants
  543. Open_Table "Constants", "APICIdx"
  544. 'flag API constants selected
  545. user_choice = 1
  546. 'resize array to hold constants database bookmarks
  547. Erase BMark
  548. DTbl.MoveLast
  549. ReDim BMark(DTbl.RecordCount)
  550. 'process selected option
  551. Select_Option
  552. End Sub
  553. Sub OptAPIDecs_Click (Value As Integer)
  554. 'open table of API Declarations
  555. Open_Table "Declarations", "APIDIdx"
  556. 'flag declarations selected
  557. user_choice = 0
  558. 'resize array to hold declaration database bookmarks
  559. Erase BMark
  560. DTbl.MoveLast
  561. ReDim BMark(DTbl.RecordCount)
  562. 'process selected option
  563. Select_Option
  564. End Sub
  565. Sub OptAPIStruct_Click (Value As Integer)
  566. 'open table of API Structures
  567. Open_Table "Structures", "APISIdx"
  568. 'flag structures selected
  569. user_choice = 2
  570. 'resize array to hold structures database bookmarks
  571. Erase BMark
  572. DTbl.MoveLast
  573. ReDim BMark(DTbl.RecordCount)
  574. 'process selected option
  575. Select_Option
  576. End Sub
  577. Sub OptVBConst_Click (Value As Integer)
  578. 'open table of VB Constants
  579. Open_Table "VB_Const", "VBCIdx"
  580. 'flag Visual BASIC constants selected
  581. user_choice = 3
  582. 'resize array to hold VB constants database bookmarks
  583. Erase BMark
  584. DTbl.MoveLast
  585. ReDim BMark(DTbl.RecordCount)
  586. 'process selected option
  587. Select_Option
  588. End Sub
  589. Sub Reset_SelectBox ()
  590. Dim selectIdx As Integer
  591. 'return select box to last selected item
  592. selectIdx = lbSelect.ListIndex
  593. lbSelect.ListIndex = -1
  594. lbSelect.ListIndex = selectIdx
  595. txtSearch.SetFocus
  596. End Sub
  597. Sub Select_Option ()
  598. 'load selectbox from database based on user selection
  599. 'suspend animation during heavy processing
  600. AniTimer.Enabled = False
  601. 'indicate busy state
  602. Busy_Flash.Visible = True
  603. Busy_Flash.Refresh
  604. Screen.MousePointer = HOURGLASS
  605. 'clear search input box and select box
  606. txtSearch = ""
  607. lbSelect.Clear
  608. 'prevent update of select box until all entries added
  609. result = SendMessageByNum(lbSelect.hWnd, WM_SETREDRAW, 0, 0&)
  610. 'load captions into select box
  611. DTbl.MoveFirst
  612.     result = SendMessageByString(lbSelect.hWnd, LB_ADDSTRING, 0, DTbl("Caption"))
  613.     BMark(result) = DTbl.Bookmark
  614.     DTbl.MoveNext
  615. Loop While Not DTbl.EOF
  616. 'update select box contents
  617. result = SendMessageByNum(lbSelect.hWnd, WM_SETREDRAW, 1, 0&)
  618. lbSelect.ListIndex = 0
  619. 'process any pending events
  620. DoEvents
  621. 'clear busy state
  622. Busy_Flash.Visible = False
  623. Screen.MousePointer = DEFAULT
  624. 'set focus to search box
  625. txtSearch.SetFocus
  626. 'resume animation
  627. If anistate Then AniTimer.Enabled = True
  628. End Sub
  629. Sub txtOutput_Change ()
  630. 'enable Export button if output box contains data
  631. 'otherwise disable the Export buton
  632. If txtOutput > "" Then
  633.     btn3DExport.Enabled = True
  634.     btn3DExport.Enabled = False
  635. End If
  636. End Sub
  637. Sub txtSearch_Change ()
  638. 'search for a match to input text in select box
  639. result = SendMessageByString(lbSelect.hWnd, LB_FINDSTRING, -1, txtSearch)
  640. 'if match found then display it
  641. If result > -1 Then
  642.     lbSelect.ListIndex = result
  643.     result = SendMessageByNum(lbSelect.hWnd, LB_SETTOPINDEX, result, 0&)
  644. End If
  645. End Sub
  646. Sub txtSearch_KeyDown (KeyCode As Integer, Shift As Integer)
  647. 'transfer control to select box if up/down cursor key
  648. Select Case KeyCode
  649.     Case KEY_CUR_UP
  650.         If lbSelect.ListIndex > 0 Then
  651.             lbSelect.ListIndex = lbSelect.ListIndex - 1
  652.         End If
  653.         txtSearch.SetFocus
  654.     Case KEY_CUR_DOWN
  655.         If lbSelect.ListIndex < lbSelect.ListCount - 1 Then
  656.             lbSelect.ListIndex = lbSelect.ListIndex + 1
  657.         End If
  658.         txtSearch.SetFocus
  659. End Select
  660. End Sub
  661. Sub txtSearch_KeyPress (KeyAscii As Integer)
  662. 'equate pressing of Enter key to
  663. 'double clicking on select box
  664. If KeyAscii = 13 Then
  665.     KeyAscii = 0
  666.     lbSelect_DblClick
  667.     txtSearch = ""
  668.     txtSearch.SetFocus
  669. End If
  670. End Sub
  671. Sub txtSearch_LostFocus ()
  672. 'clear search string
  673. txtSearch = ""
  674. End Sub
  675.