将csv文件嵌入到vb6中的exe文件中 [英] embed a csv file into exe file in vb6

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

问题描述

我试图在vb 6中安装程序,将安装程序所需的所有文件。
我使用csv文件使用

将数据导入数组

  file =C:\users\ admin\desktop\table.csv
打开文件输入为fnum

我扫描整个csv,然后获得每个数据由逗号分隔到数组



现在exe文件不能在另一台笔记本电脑中执行,我得到错误文件未找到



因此如何将此csv文档嵌入到.exe文件中,以便程序可以在任何Windows PC上运行

解决方案


  1. 打开项目,插件菜单项,打开加载项经理&双击 VB6资源编辑器以加载它。


  2. 在底部添加新资源文件 。输入文件名称&


  3. 从项目资源管理器树中双击 XXX.RES


  4. 从工具栏中选择添加自定义资源窗口


  5. 浏览到您的.csv并添加它,您应该看到它添加为 CUSTOM\101 p>


  6. 现在将在编译时嵌入到exe中。


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



    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.

解决方案

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

  2. 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.

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

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

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

  6. 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.

  7. To load it in code at runtime:

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

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

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