VB6 使用 Write #1, (UnitCount [英] VB6 using Write #1, (UnitCount

查看:29
本文介绍了VB6 使用 Write #1, (UnitCount的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用表达式的旧版 VB6 系统

I have a legacy VB6 system which uses the expression

写 #1, (UnitCount

写入文本文件.(UnitCount 是第一个写入的几个短整数.)

to write a text file. (UnitCount is the first a several short integers that are written.)

这在XP下运行良好,但在Vista和Windows 8下不会产生文本文件.没有报错.

This works well under XP but does not produce the text file under Vista and Windows 8. No error is reported.

有人知道如何解决这个问题吗?

Does anyone know how to fix this?

另外 - VB6 应用程序安装在 C:/Program Files/IronDuke

Also - the VB6 application is installed in C:/Program Files/IronDuke

并且文本文件也打算写在这里(即在当前目录中).

and the text file is intended to be written here as well (i.e. in the current directory).

我知道右括号.我只包含了声明的一部分.

I am aware of the closing bracket. I only included a section of the statement.

推荐答案

您的应用程序被视为遗留应用程序(不支持 Vista),因此您写入受保护位置的文件正在被虚拟化(而非隔离"),而不是导致安全违规异常.每个用户的配置文件路径中都存在一个文件系统 VirtualStore.

Your application is being treated as legacy (not Vista aware) and so files you write to protected locations are being virtualized (not "isolated") instead of causing a security violation exception. A filesystem VirtualStore exists in each user's profile path.

VB6 完全有可能嵌入应用程序清单,但它不会为您生成清单.您只需单独创建清单文件,然后将其作为自定义资源包含在类型 #24 和 Id #1 中,它将被直接编译.

It is perfectly possible for VB6 to embed an application manifest, though it will not generate one for you. You simply create the manifest file separately, then include it as a Custom resource with Type #24 and Id #1 and it will be compiled right in.

一个警告是清单文件应该是 UTF-8 XML 填充到 4 字节的偶数倍.如果需要填充,您可以在末尾添加空格.您可以将它从记事本保存为 ANSI,因为通常只使用 7 位 ASCII 字符子集,这样可以避免出现您不希望记事本写入的 UTF-8 BOM 的风险.

One caveat is that the manifest file should be UTF-8 XML padded to an even multiple of 4 bytes. If padding is required you can add spaces at the end. You can save this from Notepad as ANSI since generally only the 7-bit ASCII character subset is used and this avoids the risk of a UTF-8 BOM, which you do not want Notepad to write.

甚至有一些简单的方法可以在需要时绕过 WOW64 重定向,尽管没有充分的理由这样做.

There are even simple ways to bypass WOW64 redirection when required, though there isn't a good reason to do so.

但是,如果程序确实将此文件写入其当前目录,您可能会发现修改开始"菜单快捷方式或创建新快捷方式要容易得多.只需将快捷方式的当前目录(Start in")设置为某个合法的可写位置,例如您的 Documents 目录、D: 驱动器上的某个目录、Public 特殊文件夹等.

But instead you might find it far easier to either modify your Start Menu shortcut or create a new one if the program is indeed writing this file to its current directory. Just set the shortcut's current directory ("Start in") to some legaly writeable location such as your Documents directory, some directory on the D: drive, the Public special folder, etc.

这篇关于VB6 使用 Write #1, (UnitCount的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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