home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / DLLMIX.PAK / VBTOC.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-05-06  |  6.0 KB  |  169 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Calling from Visual Basic to a Borland C++ DLL"
  5.    ClientHeight    =   3156
  6.    ClientLeft      =   2256
  7.    ClientTop       =   1596
  8.    ClientWidth     =   7032
  9.    BeginProperty Font 
  10.       name            =   "MS Sans Serif"
  11.       charset         =   0
  12.       weight          =   700
  13.       size            =   7.8
  14.       underline       =   0   'False
  15.       italic          =   0   'False
  16.       strikethrough   =   0   'False
  17.    EndProperty
  18.    ForeColor       =   &H80000008&
  19.    Height          =   3540
  20.    Icon            =   "vbtoc.frx":0000
  21.    Left            =   2208
  22.    LinkTopic       =   "Form1"
  23.    MaxButton       =   0   'False
  24.    MinButton       =   0   'False
  25.    Picture         =   "vbtoc.frx":030A
  26.    ScaleHeight     =   3156
  27.    ScaleWidth      =   7032
  28.    Top             =   1260
  29.    Width           =   7128
  30.    Begin VB.CommandButton cmdClose 
  31.       Caption         =   "Close"
  32.       BeginProperty Font 
  33.          name            =   "MS Sans Serif"
  34.          charset         =   0
  35.          weight          =   400
  36.          size            =   7.8
  37.          underline       =   0   'False
  38.          italic          =   0   'False
  39.          strikethrough   =   0   'False
  40.       EndProperty
  41.       Height          =   375
  42.       Left            =   4800
  43.       TabIndex        =   5
  44.       Top             =   2520
  45.       Width           =   975
  46.    End
  47.    Begin VB.CommandButton cmdUnhandled 
  48.       Caption         =   "Unhandled Exception"
  49.       BeginProperty Font 
  50.          name            =   "MS Sans Serif"
  51.          charset         =   0
  52.          weight          =   400
  53.          size            =   7.8
  54.          underline       =   0   'False
  55.          italic          =   0   'False
  56.          strikethrough   =   0   'False
  57.       EndProperty
  58.       Height          =   375
  59.       Left            =   4080
  60.       TabIndex        =   4
  61.       Top             =   2040
  62.       Width           =   2655
  63.    End
  64.    Begin VB.CommandButton cmdExceptionTest 
  65.       Caption         =   "Exception Test"
  66.       BeginProperty Font 
  67.          name            =   "MS Sans Serif"
  68.          charset         =   0
  69.          weight          =   400
  70.          size            =   7.8
  71.          underline       =   0   'False
  72.          italic          =   0   'False
  73.          strikethrough   =   0   'False
  74.       EndProperty
  75.       Height          =   375
  76.       Left            =   4080
  77.       TabIndex        =   3
  78.       Top             =   1560
  79.       Width           =   2655
  80.    End
  81.    Begin VB.CommandButton cmdAverage 
  82.       Caption         =   "double Average(double, float)"
  83.       BeginProperty Font 
  84.          name            =   "MS Sans Serif"
  85.          charset         =   0
  86.          weight          =   400
  87.          size            =   7.8
  88.          underline       =   0   'False
  89.          italic          =   0   'False
  90.          strikethrough   =   0   'False
  91.       EndProperty
  92.       Height          =   375
  93.       Left            =   4080
  94.       TabIndex        =   2
  95.       Top             =   1080
  96.       Width           =   2655
  97.    End
  98.    Begin VB.CommandButton cmdMultiply 
  99.       Caption         =   "long Multiply(short, int)"
  100.       BeginProperty Font 
  101.          name            =   "MS Sans Serif"
  102.          charset         =   0
  103.          weight          =   400
  104.          size            =   7.8
  105.          underline       =   0   'False
  106.          italic          =   0   'False
  107.          strikethrough   =   0   'False
  108.       EndProperty
  109.       Height          =   375
  110.       Left            =   4080
  111.       TabIndex        =   1
  112.       Top             =   600
  113.       Width           =   2655
  114.    End
  115.    Begin VB.CommandButton cmdMessage 
  116.       Caption         =   "int Message(const char *)"
  117.       BeginProperty Font 
  118.          name            =   "MS Sans Serif"
  119.          charset         =   0
  120.          weight          =   400
  121.          size            =   7.8
  122.          underline       =   0   'False
  123.          italic          =   0   'False
  124.          strikethrough   =   0   'False
  125.       EndProperty
  126.       Height          =   375
  127.       Left            =   4080
  128.       TabIndex        =   0
  129.       Top             =   120
  130.       Width           =   2655
  131.    End
  132. Attribute VB_Name = "Form1"
  133. Attribute VB_Creatable = False
  134. Attribute VB_Exposed = False
  135.  Private Declare Function VBMessage Lib "Bcdll.dll" (ByVal msg As String) As Integer
  136.  Private Declare Sub VBExceptionTest Lib "Bcdll.dll" ()
  137.  Private Declare Sub VBUnhandledException Lib "Bcdll.dll" ()
  138.  Private Declare Function VBMultiply Lib "Bcdll.dll" (ByVal num1 As Integer, ByVal num2 As Long) As Long
  139.  Private Declare Function VBAverage Lib "Bcdll.dll" (ByVal num1 As Double, ByVal num2 As Single) As Double
  140. Private Sub cmdAverage_Click()
  141.     Dim num1 As Double
  142.     Dim num2 As Single
  143.     num1 = 6232.001
  144.     num2 = 128.327
  145.     MsgBox "The Average of 6232.001 and 128.327 is : " & VBAverage(num1, num2), vbOKOnly, "Visual Basic"
  146. End Sub
  147. Private Sub cmdClose_Click()
  148.     Unload Form1
  149. End Sub
  150. Private Sub cmdExceptionTest_Click()
  151.     Call VBExceptionTest
  152. End Sub
  153. Private Sub cmdMessage_Click()
  154.         VBMessage ("A message from Visual Basic")
  155. End Sub
  156. Private Sub cmdMultiply_Click()
  157.     MsgBox "55 * -1024 = " & VBMultiply(55, -1024), vbOKOnly, "Visual Basic"
  158. End Sub
  159. Private Sub cmdUnhandled_Click()
  160.     'Note that VB does not have exception handling capabilities.
  161.     'The exception will be passed from the DLL to the Visual Basic app and cause the application to terminate.
  162.     result = MsgBox("Visual Basic is not able to catch exceptions. If you continue the application will terminate. Do you wish to continue?", vbYesNo + vbExclamation + vbApplicationModal, "Visual Basic")
  163.     If result = vbYes Then
  164.         Call VBUnhandledException
  165.     Else
  166.         MsgBox "Exception was not thrown.", vbOKOnly, "Visual Basic"
  167.     End If
  168. End Sub
  169.