VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)
首页 - 经验之谈 - VB问题全功略(50)
发表评论(0)作者:不详, 平台:VB6.0+Win98, 阅读:11952, 日期:2002-02-02
VB问题全功略(50)

246、您知道 Microsoft 不再支持那些 VB 的版本吗?
247、您知道 Microsoft 不再更新 COMCTL32, COMCT232, MSChart 三个控制项的新版本了吗?
248、如何建立多级目录
249、如何从全路径名中提取文件名
250、如何检测文件是否存在
246、您知道 Microsoft 不再支持那些 VB 的版本吗?

Microsoft 的每一个软件,一年一年的推出新版本,但是并不会立刻就不支持旧的版本,通常都是新旧并行,而且我认为有一点点可恶的是,通常 Microsoft 推出新版本的同时,却还是继续卖旧的版本!

但是对于旧版本的支持并不是永久的,一段时间之后, Microsoft 就会宣判某一个软件的某一个版本死刑!并且将这些资讯公布在 Microsoft product support services 的网页上。

您知道到目前 (88.12.24) 为止,有那些 Microsoft 的软件被判死刑了吗 (指 Microsoft 技术中心不再支持)?列表如下,您看看有没有您还在使用的软件版本,如果有的话,该准备升级了!

不再支持的旧软件版本 可取代的新软件版本
A.L.D.S. (CPM/80) MASM
Access Communications Package 1.02 Works for Windows
Access Distribution Kit 1.0 Access versions 7.0, 97
Access for Windows, 1.x Access versions 7.0, 97
Access Solutions Pack 1.0 n/a
Adventure for the Apple II n/a
Altimera Composer for Windows SoftImage product line
Apple II and Apple III Operating Systems n/a
Assembler 3.44 MASM 6.1
Asymetrix Daybook 1.0 Schedule+ for Windows
AutoDemo for Macintosh, 1.0 n/a
AutoMac 2.1 Excel for the Macintosh
Automap Road Atlas 3.x for MS-DOS Automap Trip Planner for Windows 95 or Automap Road Atlas 4.0 for Windows
Basic Compiler 5.3 (CPM/80) Visual Basic
Basic Compiler for SoftCard 5.35 (CPM/80) Visual Basic
Basic Interpreter 5.21 (CPM/80) Visual Basic
Beta Software Migration Kit (OS/2) Windows NT Resource Kit
Bob Works and Home Essentials Bundle
Bookshelf 87 for MS-DOS Bookshelf for Windows
Bookshelf 91 for MS-DOS Bookshelf for Windows
C/C++ Compiler 7.0 Visual C 4.2
Chart Excel or Works
Chart 1.02 for the Macintosh Excel for the Macintosh
Chart 3.0 for MS-DOS Excel for Windows
Cobol Third-party support   Micro Focus
CPM/80 Operating System Windows 95
DCA/MS Comm Server Workstation 8.0 (OS/2) SNA and SQL Server
Decathlon for the Apple II 1.0 Full line of Microsoft Games
Edit (CPM/80) Notepad in Windows 95
Excel Q+E n/a
FILE for Macintosh Works for Macintosh
Fortran Digital Purchased Fortran 1-800-DIGITAL
FoxPro for Macintosh Professional and Standard 2.5 and 2.6 FoxPro for Macintosh 3.0 or Visual FoxPro for Windows
FoxPro for MS-DOS, 1.0, 2.0, 2.5 and 2.6 Visual FoxPro for Windows
FoxPro for MS-DOS and Windows Connectivity Kit 2.5 Visual FoxPro for Windows
FoxPro for MS-DOS Distribution Kit 2.0 and 2.5 Visual FoxPro for Windows
FoxPro for MS-DOS Library Construction Kit 2.0 Visual FoxPro for Windows
FoxPro for UNIX, 2.6 Visual FoxPro for Windows
FoxPro for Windows, 2.5 and 2.6 Visual FoxPro for Windows
FoxPro for Windows Distribution Kit 2.5 Visual FoxPro for Windows
FoxPro for Windows Library Construction Kit 2.5 Visual FoxPro for Windows
Internet Services Network 98 n/a
LAN Manager 2.0 Multiprocessor 2.0 (OS/2) Windows NT Server
Learn MS-DOS n/a
MAC Enhancer 2.0 n/a
MACH 10 and 20 v 1.0 n/a
Mach Daughter Board 10 and 20 80286 processor
MASM 6.0 MASM 6.11a
Mediaview Author n/a
Microsoft Delta SourceSafe
Mouse PC Paintbrush 3.1 Paintbrush featured in Windows 95
Mouse Show Partner 2.2 Slideshow feature in PowerPoint
MS Profit for Windows Microsoft Money
Multimedia Viewer Internet Studio
Multiplan 1.06 for the CPM/80 Excel for the Macintosh
Multiplan 1.07 for the Apple II Excel for the Macintosh
Multiplan 4.0 for OS/2 Excel for Windows
Mutliplan 1.12 for the Apple III Excel for the Macintosh
NT Hardware Capability Test n/a
OEM Money 2.0 Microsoft Money
OEM Works for MS-DOS Works for Windows
OS/2 Binary Adaptation Kit 1.0 NT Windows 32 SDK, NT, MSDN
OS/2 Device Driver Development Kit 1.0 Third-party support - IBM; Windows NT DDK
OS/2 for the MAC 20 1.0 n/a
OS/2 Programmer注释:s Toolkit 1.0 Third-party support - IBM; Windows 32 SDK
OS/2 Software Development Kit 1.1 Third-party support - IBM; Windows 32 SDK for Windows NT
OS/2 Video Adaptation Kit 1.0 Windows NT
Pageview for MS-DOS, 1.0 Publisher
Pascal Third-party support   Microfocus
PC Junior Booster 1.0 n/a
Premium Software II 2.26B n/a
Presentation Manager 1.1 (OS/2) NT Presentation Manager Sub System
Quick Basic for Macintosh Visual Basic for Applications in Office for the Macintosh
Quick Basic for MS-DOS Visual Basic 5.0
Quick Basic Professional Development System (PDS) Visual Basic 5.0
QuickC for Windows Visual C 4.2 Standard
Small Business Consultant for MS-DOS, 1.0 Microsoft Small Business Pack
SoftCard 2.23 (CPM/80) n/a
SoftCard II, version 2.28B (CPM/80) n/a
SourceSafe 3.0 and 3.1 Visual SourceSafe 5.0
SourceSafe for the Macintosh, 3.0 Visual SourceSafe 5.0
SQL Server for OS/2 SQL Server for Windows NT
Typing Tutor 1.2 for the Apple II Mavis Beacon Typing by Software Toolworks
Upgrade Advisor for Windows Help files in Windows 95
Visual Basic for MS-DOS, 1.0 Visual Basic for Windows, 5.0
Visual Basic for Windows Professional and Standard Editions 1.0, 2.0, and 3.0 Visual Basic for Windows, 5.0
Visual C for Macintosh Add-on 2.1 Visual C Macintosh Add-on 4.0
Visual C for Windows NT (Alpha) 2.0 Visual C 4.0 for the Alpha
Visual C for Windows NT (MIPS) 2.1 Visual C 4.0 (RISC)
Visual C for Windows NT 1.0 and 2.0 Visual C 4.2
Visual C for Windows Professional 1.0 Visual C 4.2
Visual C for Windows Standard Visual C 4.2
Visual Test 1.0, 2.0, 3.0, and 4.0 Contact Rational for support at (800) 728-1212 (inside the U.S. and Canada) or +1-703-761-4400 (outside the U.S. and Canada).
Windows/MS-DOS Bundle Windows 95
Windows Printing System 1.0 Windows 95 Print Engine
Word for Macintosh, 1.x Word for Macintosh, 5.x and higher
Word for MS-DOS, 1.0 Word for Windows
Word for Windows, 1.x Word for Windows, 6.0 or Word 97
Works for Macintosh, 1.0 and 2.0 Works for Macintosh, 4.0
Works for MS-DOS, 1.0 and 2.0 Works for Windows

247、您知道 Microsoft 不再更新 COMCTL32, COMCT232, MSChart 三个控制项的新版本了吗?

当您从 VB5 升级到 VB6 时,或许您会注意到 COMCTL32.OCX, COMCT232.OCX, MSChart.OCX 三个控制项的版本仍然是 5.0(SP2),刚开始,我以为 Microsoft 不再升级这三个控制项了,不过我错了!

这三个控制项有升级的版本,但是 Microsoft 改变了它们的文件名称、介面,
而且,在您将项目从 VB5 升级到 VB6 时,VB6 也不会主动升级这些控制项!

它们的新旧文件名对照如下:

旧文件名 新文件名
comctl32.ocx mscomctl.ocx
comct232.ocx mscomct2.ocx
mschart.ocx mschrt20.ocx

现在请勿马上动手开始修改程序,如果您想手动 Upgrade 这些控制项到新的版本,您一定会后悔!因为在您手动 Upgrade 之后,您一执行就会出现错误讯息!而且是没有说明按钮的错误讯息!

现在,在 Microsoft 的网站上有提供一个升级工具程序,叫做 ActiveX Control Upgrade Utility,它会侦测您的项目,并自动 Upgrade 这些应该升级的控制项!它很容易使用,而且效果很好,如果您想知道更多的讯息,或想下载这个工具程序,可以到以下这个网址去:

http://msdn.microsoft.com/vbasic/downloads/axupgrade.asp

在这里,您也可以直接下载这个工具程序:

注:如果您不想看 Microsoft 的英文说明,我将它翻译在下面好了:

Visual Basic, Version 6.0, ActiveX Control Upgrade Utility

这个升级工具会将您以前使用 VB5.0 及较早前发行的 VB6.0 版本开发的项目,其中较旧版本的 ActiveX 控制项升级到目前的 VB6.0 最新版本的 ActiveX 控制项,它可以升级的控制项包括以下三个:

描述的名称 .OCX 文件名称
Microsoft Windows Common Controls COMCTL32.OCX
Microsoft Windows Common Controls-2 COMCT232.OCX
Microsoft Chart Control MSChart.OCX

如果在您开发的项目中,不包含以上三个控制项,那么它什么也不会做!
( 意思就是说,如果项目中,不含以上三个控制项,您根本就不用使用这个升级工具 )

在您使用升级工具将项目转换完成后,以上三个控制项会变成:

描述的名称 .OCX 文件名称
Microsoft Windows Common Controls 6.0 MSCOMCTL.OCX
Microsoft Windows Common Controls-2 6.0 MSCOMCT2.OCX
Microsoft Chart Control 6.0 (OLEDB) MSChrt20.OCX

要特别注意的是,在转换前最好先备份您用 VB5 开发的项目!且不要使用 binary compatibility 转换!

248、如何建立多级目录

Sub CreateLongDir(sDrive As String, sDir As String)
Dim sBuild As String

While InStr(2, sDir, "\") > 1
sBuild = sBuild & left(sDir, InStr(2, sDir, "\") - 1)
sDir = Mid(sDir, InStr(2, sDir, "\"))
If Dir(sDrive & sBuild, 16) = "" Then
MkDir sDrive & sBuild
End If
Wend
End Sub

249、如何从全路径名中提取文件名

Function StripPath(T$) As String
Dim x%, ct%
StripPath$ = T$
x% = InStr(T$, "\")
Do While x%
ct% = x%
x% = InStr(ct% + 1, T$, "\")
Loop
If ct% > 0 Then StripPath$ = Mid$(T$, ct% + 1)
End Function
例子:
File = StripPath("c:\windows\hello.txt")

250、如何检测文件是否存在

Function FileExists(FileName As String) As Boolean
On Error Resume Next
FileExists = Dir$(FileName) <> ""
If Err.Number <> 0 Then
FileExists = False
End If
On Error GoTo 0
End Function