home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / idvb / idother.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  5.0 KB  |  138 lines

  1. VERSION 2.00
  2. Begin Form IDOTHER 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "More IDdemo"
  5.    ClientHeight    =   4005
  6.    ClientLeft      =   1350
  7.    ClientTop       =   1740
  8.    ClientWidth     =   7305
  9.    Height          =   4410
  10.    Left            =   1290
  11.    LinkMode        =   1  'Source
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   4005
  16.    ScaleWidth      =   7305
  17.    Top             =   1395
  18.    Width           =   7425
  19.    Begin CommandButton Command5 
  20.       Caption         =   "GetDlgItemText >>"
  21.       Height          =   495
  22.       Left            =   360
  23.       TabIndex        =   7
  24.       Top             =   3120
  25.       Width           =   2415
  26.    End
  27.    Begin CommandButton Command4 
  28.       Caption         =   "GetDlgItemInt >>"
  29.       Height          =   495
  30.       Left            =   360
  31.       TabIndex        =   6
  32.       Top             =   2400
  33.       Width           =   2415
  34.    End
  35.    Begin ComboBox Combo1 
  36.       Height          =   300
  37.       Left            =   3120
  38.       Style           =   2  'Dropdown List
  39.       TabIndex        =   5
  40.       Top             =   1800
  41.       Width           =   3855
  42.    End
  43.    Begin CommandButton Command3 
  44.       Caption         =   "SendDlgItemMessage >>"
  45.       Height          =   495
  46.       Left            =   360
  47.       TabIndex        =   4
  48.       Top             =   1680
  49.       Width           =   2415
  50.    End
  51.    Begin CommandButton Command2 
  52.       Caption         =   "SetDlgItemText >>"
  53.       Height          =   495
  54.       Left            =   360
  55.       TabIndex        =   2
  56.       Top             =   960
  57.       Width           =   2415
  58.    End
  59.    Begin CommandButton Command1 
  60.       Caption         =   "SetDlgItemInt >>"
  61.       Height          =   495
  62.       Left            =   360
  63.       TabIndex        =   0
  64.       Top             =   240
  65.       Width           =   2415
  66.    End
  67.    Begin Label Label4 
  68.       Height          =   255
  69.       Left            =   3120
  70.       TabIndex        =   9
  71.       Top             =   3240
  72.       Width           =   3855
  73.    End
  74.    Begin Label Label3 
  75.       Height          =   255
  76.       Left            =   3120
  77.       TabIndex        =   8
  78.       Top             =   2520
  79.       Width           =   3855
  80.    End
  81.    Begin Label Label2 
  82.       Height          =   255
  83.       Left            =   3120
  84.       TabIndex        =   3
  85.       Top             =   1080
  86.       Width           =   3855
  87.    End
  88.    Begin Label Label1 
  89.       Height          =   255
  90.       Left            =   3120
  91.       TabIndex        =   1
  92.       Top             =   360
  93.       Width           =   3855
  94.    End
  95. DefInt A-Z
  96. Declare Function SendDlgItemMessage Lib "User" (ByVal hDlg As Integer, ByVal nIDDlgItem As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Any) As Long
  97. Declare Sub SetDlgItemInt Lib "User" (ByVal hDlg As Integer, ByVal nIDDlgItem As Integer, ByVal wValue As Integer, ByVal bSigned As Integer)
  98. Declare Function GetDlgItemInt Lib "User" (ByVal hDlg As Integer, ByVal nIDDlgItem As Integer, lpTranslated As Integer, ByVal bSigned As Integer) As Integer
  99. Declare Sub SetDlgItemText Lib "User" (ByVal hDlg As Integer, ByVal nIDDlgItem As Integer, ByVal lpString As String)
  100. Declare Function GetDlgItemText Lib "User" (ByVal hDlg As Integer, ByVal nIDDlgItem As Integer, ByVal lpString As String, ByVal nMaxCount As Integer) As Integer
  101. Declare Function EnableWindow Lib "User" (ByVal hWnd As Integer, ByVal aBOOL As Integer) As Integer
  102. Declare Function GetDlgItem Lib "User" (ByVal hDlg As Integer, ByVal nIDDlgItem As Integer) As Integer
  103. ' IDs of the controls we'll be needing
  104. Const IDS_LABEL1 = 2
  105. Const IDS_LABEL2 = 4
  106. Const IDB_COMMAND3 = 5
  107. Const IDC_COMBO1 = 6
  108. Const IDS_LABEL3 = 8
  109. Const IDS_LABEL4 = 10
  110. Sub Command1_Click ()
  111.     ' set Label1.Caption to the form's hWnd - no need for Str$()
  112.     SetDlgItemInt IdOther.hWnd, IDS_LABEL1, IdOther.hWnd, 0
  113. End Sub
  114. Sub Command2_Click ()
  115.     ' set Label2.Caption to the form's caption
  116.     SetDlgItemText IdOther.hWnd, IDS_LABEL2, (IdOther.caption)
  117. End Sub
  118. Sub Command3_Click ()
  119.     CB_DIR = (&H400 + 5)
  120.     CB_SETCURSEL = (&H400 + 14)
  121.     ' fill the combo box with a drive/directory listing
  122.     Mes& = SendDlgItemMessage(IdOther.hWnd, IDC_COMBO1, CB_DIR, &HC010, ByVal "*.*")
  123.     ' set the current selection to entry #2
  124.     Mes& = SendDlgItemMessage(IdOther.hWnd, IDC_COMBO1, CB_SETCURSEL, 2, ByVal 0&)
  125.     ' disable Command3 to demo GetDlgItem
  126.     Disable = EnableWindow(GetDlgItem(IdOther.hWnd, IDB_COMMAND3), 0)
  127. End Sub
  128. Sub Command4_Click ()
  129.     ' get the integer from label1.caption and set it to label3.caption
  130.     SetDlgItemInt IdOther.hWnd, IDS_LABEL3, GetDlgItemInt(IdOther.hWnd, IDS_LABEL1, 0, 1), 0
  131. End Sub
  132. Sub Command5_Click ()
  133.     ' get the text from label2.caption and copy it to label4
  134.     Buf$ = String$(30, 0)
  135.     Ok = GetDlgItemText(IdOther.hWnd, IDS_LABEL2, Buf$, Len(Buf$))
  136.     SetDlgItemText IdOther.hWnd, IDS_LABEL4, Buf$
  137. End Sub
  138.