我不希望ProgramData中的C ++应用程序MDB复制到用户的AppData文件夹中 [英] C++ app MDB in ProgramData copies to user's AppData folder when I dont want it to

查看:78
本文介绍了我不希望ProgramData中的C ++应用程序MDB复制到用户的AppData文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个C ++程序,该程序通过OBDC System DSN连接连接到Access数据库.该DSN是ProgramData文件夹中MDB的路径.当用户A运行该应用程序时,它将那个MDB文件复制到他们的AppData \ Local文件夹中,并对该应用程序进行的MDB进行任何更新,并复制到其AppData文件夹中的MDB中.这不好,因为如果用户B运行应用程序,我希望他们看到用户A对MDB所做的更改.

I have a C++ program which connects to an Access database via OBDC System DSN connection. That DSN is a path to the MDB in the ProgramData folder. When User A runs the app, it copies that MDB file to their AppData\Local folder and any updates to the MDB the app makes, it does to the one in their AppData folder. This is no good because if User B runs the app I want them to see the changes that User A made to the MDB.

1)是否有一种方法可以强制它不要将MDB复制到他们的AppData文件夹中,而只能在ProgramData中使用它?

1) Is there a way to force it to NOT copy the MDB to their AppData folder and instead just use the one in ProgramData?

2)我这样做正确吗?我应该将MDB放置在ProgramData以外的其他位置上,以便正确共享它吗?

2) Am I doing this correctly? Should I be putting the MDB in a different location other than ProgramData where it will be properly shared?

3)我需要让我的应用程序在启动时比较MDB的时间戳吗?在启动时,我可以将其从ProgramData中拉出,当它关闭时,可以将其写回到ProgramData中吗?这似乎是一种黑客行为,我什至不知道权限是否会成为问题

3) Do I need to have my app on start up compare timestamps for the MDB? On start up I could have it pull from ProgramData and when it closes I could have it write back to ProgramData? This seems like a hack and I dont even know if permissions would be an issue

推荐答案

此帖子与OP的评论和古斯塔夫先前的回答有关:

This post is relevant to OP's comment and previous answer by Gustav:

使用共享文件夹%Public%(的子文件夹),该文件夹指向C:\ Users \ Public.

Use (a subfolder of) the shared folder, %Public% which directs to C:\Users\Public.

我也不是Inno设置专家,但我认为"C:\ Users \ Public"的预定义常量不存在.但是,如果只希望它是一个常数,则可以始终执行此操作.

I am not an Inno setup expert either but I don't think a predefined constant for "C:\Users\Public" exists. But if its only a constant you want you can always do this.

使用诸如此类的脚本顶部的 #define 宏创建常量.

Create a constant using #define macro at the very top of your script such as this.

#define sf "C:\Users\Public"

您可以在任意位置的脚本中使用它.例如:

And you can use it in your script wherever you want. Ex:

[Files]
Source: "app.exe"; DestDir: "{#sf}\MyApp\";

这篇关于我不希望ProgramData中的C ++应用程序MDB复制到用户的AppData文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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