将文件嵌入到VB6中的EXE文件中 [英] Embed a file into EXE file in VB6

查看:202
本文介绍了将文件嵌入到VB6中的EXE文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在VB6中制作一个安装程序,该程序将安装该程序所需的所有文件。

I am trying to make a setup program in VB6 that will install all the files that are required for the program.

我使用CSV文件存储数据并使用以下命令读取它:

I use a CSV file to store data and read it using:

file="C:\users\admin\desktop\table.csv"
Open file For Input As fnum

但是我得到的EXE文件无法在另一台笔记本电脑上执行错误 <找不到code>文件。

However the EXE file cannot be executed on another laptop as I get the error "file not found".

因此:如何将此CSV文档嵌入到中。 EXE文件,以便程序可以在任何Windows PC上运行

推荐答案


  1. 打开项目,加载项菜单项,打开加载项管理器,双击 VB6资源编辑器加载它,关闭管理器。

  1. Open the project, Add-Ins menu item, open the Add-In manager & double click the VB6 Resource Editor to load it, close manager.

单击 Project 菜单项,然后在底部 Add new Resource File 。输入文件名&

Click Project menu item then Add new Resource File at the bottom. Enter a file name for it & save it in the directory with your code files.

Project Explorer 树中双击 XXX .RES 从新的 Related Documents 节点中。

From the Project Explorer tree double click XXX.RES from the new Related Documents node.

选择添加自定义资源,从弹出窗口的工具栏中

Select Add Custom Resource from the toolbar in the window that pops up

浏览到.csv并将其添加,您应该看到它添加为 CUSTOM\101

Browse to your .csv and add it, you should see it added as CUSTOM\101

现在它将在编译时嵌入到exe中。如果文件发生更改,请将其重新添加到资源中,每个条目的限制为64k。

It will now be embedded into the exe at compile time. If the file changes, re-add it to the resource, there is a 64k limit per entry.

在运行时将其加载到代码中:

To load it in code at runtime:

strCSV = strconv(LoadResData(101, CUSTOM),vbunicode)

这篇关于将文件嵌入到VB6中的EXE文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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