📄 frmselectoutputsource.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmSelectOutputSource
BorderStyle = 3 'Fixed Dialog
Caption = "Select Output Source"
ClientHeight = 3756
ClientLeft = 48
ClientTop = 336
ClientWidth = 3012
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3756
ScaleWidth = 3012
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin MSComDlg.CommonDialog dlgCommon
Left = 240
Top = 3240
_ExtentX = 847
_ExtentY = 847
_Version = 393216
CancelError = -1 'True
DialogTitle = "Select Output Source"
Filter = "Schema Files (*.sch)|*.sch|All Files (*.*)|*.*"
End
Begin VB.CommandButton btnCancel
Cancel = -1 'True
Caption = "&Cancel"
Height = 375
Left = 1320
TabIndex = 4
Top = 3240
Width = 735
End
Begin VB.Frame Frame1
Caption = "Known Output Sources"
Height = 2895
Left = 120
TabIndex = 1
Top = 120
Width = 2775
Begin VB.CommandButton btnBrowse
Caption = "&Browse..."
Height = 375
Left = 1800
TabIndex = 3
Top = 2400
Width = 855
End
Begin VB.ListBox lstOutputSources
Height = 1968
Left = 120
TabIndex = 2
Top = 240
Width = 2535
End
End
Begin VB.CommandButton btnOk
Caption = "&Ok"
Default = -1 'True
Height = 375
Left = 2160
TabIndex = 0
Top = 3240
Width = 735
End
End
Attribute VB_Name = "frmSelectOutputSource"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' DataMonkey Data Conversion Application. Written by Theodore L. Ward
' Copyright (C) 2002 AstroComma Incorporated.
'
' This program is free software; you can redistribute it and/or
' modify it under the terms of the GNU General Public License
' as published by the Free Software Foundation; either version 2
' of the License, or (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program; if not, write to the Free Software
' Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
' The author may be contacted at:
' TheodoreWard@Hotmail.com or TheodoreWard@Yahoo.com
Option Explicit
Dim mSelectedIndex As Integer
Dim mOutputSources(1 To 2, 1 To 100) As String
Dim mNumOutputSources As Integer
Private Sub btnBrowse_Click()
On Error GoTo eHandler
Dim name As String
Dim i As Integer
' Get the filename.
dlgCommon.ShowOpen
' Get the name of the new item.
If GetNameFromFile(dlgCommon.fileName, name) Then
' Make sure this item isn't already in our list.
For i = 0 To lstOutputSources.ListCount - 1
If lstOutputSources.List(i) = name Then
MsgBox name + " is already in the list", vbOKOnly Or vbInformation, "Error"
Exit Sub
End If
Next i
' Store the new filename and schema name.
mNumOutputSources = mNumOutputSources + 1
mOutputSources(1, mNumOutputSources) = dlgCommon.fileName
mOutputSources(2, mNumOutputSources) = name
lstOutputSources.AddItem name
lstOutputSources.ListIndex = lstOutputSources.ListCount
End If
eHandler:
End Sub
Private Sub btnCancel_Click()
GFormReturnValue = vbCancel
Me.Hide
End Sub
Private Sub btnOk_Click()
If mSelectedIndex = -1 Then
MsgBox "Select an item from the listbox, or press Cancel", vbOKOnly Or vbInformation, "Error"
Exit Sub
End If
GFormReturnValue = vbOK
Me.Hide
End Sub
Public Function GetChosenSource(ByRef fileName As String, ByRef SourceName As String) As Boolean
If mSelectedIndex = -1 Then
GetChosenSource = False
Exit Function
End If
GetChosenSource = IIf(GFormReturnValue = vbOK, True, False)
fileName = mOutputSources(1, mSelectedIndex)
SourceName = mOutputSources(2, mSelectedIndex)
End Function
Private Sub Form_Load()
Dim i As Integer
mSelectedIndex = -1
With lstOutputSources
' Clear the output sources list.
.Clear
' Add all the available output sources to the list control.
mNumOutputSources = _
osGetOutputSourceNames(mOutputSources)
For i = 1 To mNumOutputSources
.AddItem mOutputSources(2, i)
.ItemData(.ListCount - 1) = i
Next i
End With
End Sub
Private Sub lstOutputSources_Click()
mSelectedIndex = lstOutputSources.ListIndex + 1
End Sub
Private Sub lstOutputSources_DblClick()
Call btnOk_Click
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -