将csv文件嵌入到vb6中的exe文件中 [英] embed a csv file into exe file in vb6
问题描述
我试图在vb 6中安装程序,将安装程序所需的所有文件。
我使用csv文件使用
file =C:\users\ admin\desktop\table.csv
打开文件输入为fnum
我扫描整个csv,然后获得每个数据由逗号分隔到数组
现在exe文件不能在另一台笔记本电脑中执行,我得到错误文件未找到
因此如何将此csv文档嵌入到.exe文件中,以便程序可以在任何Windows PC上运行。
-
打开项目,插件菜单项,打开加载项经理&双击 VB6资源编辑器以加载它。
-
在底部添加新资源文件 。输入文件名称&
-
从项目资源管理器树中双击 XXX.RES
-
从工具栏中选择添加自定义资源窗口
-
浏览到您的.csv并添加它,您应该看到它添加为 CUSTOM\101 p>
-
现在将在编译时嵌入到exe中。
-
要在运行时将其加载到代码中:
strCSV = strconv(LoadResData(101,CUSTOM),vbunicode)
I am trying to make a setup program in vb 6 that will install all the files that are required for the program. I used a csv file to import data into an array using
file="C:\users\admin\desktop\table.csv"
Open file For Input As fnum
then i scan whole csv and then get each data seperated by comma into the array
Now the exe file cannot be executed in another laptop and I get the error "file not found".
So how to embed this csv document into the .exe file so that the program can run in any windows pc.
Open the project, Add-Ins menu item, open the Add-In manager & double click the VB6 Resource Editor to load it, close manager.
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.
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
Browse to your .csv and add it, you should see it added as CUSTOM\101
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)
这篇关于将csv文件嵌入到vb6中的exe文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!