在运行时使用的最后一个驱 [英] Last Drive used at runtime

查看:83
本文介绍了在运行时使用的最后一个驱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种简单的方法可以告诉用什么驱动器在VB中加载程序?



我的问题是我写了一个程序,一旦安装就需要检查它安装的

驱动器。这样我可以在以后的程序中使用这些数据。



像E:\ install之类的东西并捕获该驱动器号以便在程序中使用。

此时我想让程序运行并添加信息,以便写入

以在闪存驱动器上运行。



任何建议都会有很大的帮助......

Is there a simple way to tell what drive was used to load a program in VB?

My problem is I wrote a program, once installed it needs to check the
drive it was installed FROM. That way I can use that data later on in that program.

Something like E:\install and capture that drive letter for use in the program.
At this point I want the program to run and add information so its being written
to run on a flash drive.

Any suggestion would be a great help...

推荐答案

自从我上次使用VB6以来已有十多年了。不幸的是,我没有可用于测试我的解决方案的副本。



我相信以下内容将检索执行程序的路径:
It has been more than a decade since I last used VB6. Unfortunately, I don''t have a copy that I can use to test my solution.

I believe that the following will retrieve the path to the executing program:
App.Path



从此字符串中,您应该能够提取驱动器号或UNC路径(如果程序是从文件服务器运行的)。



我在 MSDN网站上发现了以下内容[ ^ ]。它显示了 App.Path 如何用于获取正在执行的程序的路径。



下面的示例演示如何通过检索正在执行的应用程序的路径来显示存储在应用程序文件夹中的图像文件。



''Visual Basic 6.0

Picture1.Picture = LoadPicture(App.Path&\标志.jpg)


From this string, you should be able to extract either the drive letter or the UNC path (if the program is run from a file server).

I found the following on the MSDN web site[^]. It shows how App.Path is used to get the path of the executing program.

The following example demonstrates how to display an image file that is stored in the application''s folder by retrieving the path to the executing application.

'' Visual Basic 6.0
Picture1.Picture = LoadPicture(App.Path & "\Logo.jpg")


这篇关于在运行时使用的最后一个驱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆