使用 DDE 在 Windows 7 中运行旧程序时出现问题

发布于 2024-10-30 08:53:46 字数 5291 浏览 8 评论 0原文

我的管理员遇到了一个大问题,我将他们的困境转述给 SO:

我们有一个遗留数据库应用程序(用 Progress 4GL/OpenEdge 编写),它调用 WordPerfect X3 来生成报告。 WordPerfect 可执行文件的路径以及要插入数据库的扫描 PDF 的位置是硬编码在数据库应用程序中的,我们无法修改该程序

我们的大多数工作站已成功从WinXP迁移到Win7,并且遗留应用程序工作正常,直到它尝试调用WordPerfect,说它找不到可执行文件(甚至X3 安装在与 WinXP 上使用的完全相同的路径中)...与扫描的文档文件夹相同。

有什么建议吗?


更新:

今天早上我花了很多时间帮助我的管理员提供你们提供的各种建议...我们检查了文件权限,使用十六进制编辑器查看了编译后的 (.r) 文件(感谢 @Tom 和@Ernest),并使用 Notepad++ 在所有源代码 (.p) 中搜索文件

这是我的发现:该程序没有直接调用 WordPerfect(正如我最初得知的),而是使用 DDE。以下是 Progress 4GL 生成的错误消息:

DDE INITIATE Failed. (3153)

我知道 DDE 存在问题,并且Win7,所以我想知道是否有解决方法,也许需要修改注册表项或有影响的东西。

我在下面摘录了源代码,希望有人能意识到发生了什么(我不熟悉 Progress 4GL,所以对我来说这都是希腊语):

/* setup DDE communicaiton with WordPerfect 12   */
/* and perform the merge of the various document */

DEFINE VARIABLE sys             AS INTEGER NO-UNDO.
DEFINE VARIABLE mline           AS CHAR FORMAT "x(220)" NO-UNDO.
DEFINE VARIABLE intResult       AS INTEGER NO-UNDO.
DEFINE VARIABLE err-status AS INTEGER.

{GLOBVAR.I}
DEFINE VAR C-Win AS WIDGET-HANDLE NO-UNDO.

DEFINE FRAME FRAME-b
    WITH 1 DOWN KEEP-TAB-ORDER OVERLAY 
         SIDE-LABELS NO-UNDERLINE THREE-D 
         AT COL 13 ROW 4.1
         SIZE 11 BY 2
         TITLE "FRAMEWP".

IF SESSION:DISPLAY-TYPE = "GUI":U THEN
  CREATE WINDOW C-Win ASSIGN
         HIDDEN             = YES
         HEIGHT             = 4
         WIDTH              = 20
         MAX-HEIGHT         = 4
         MAX-WIDTH          = 20
         VIRTUAL-HEIGHT     = 4
         VIRTUAL-WIDTH      = 20
         RESIZE             = yes
         SCROLL-BARS        = no
         STATUS-AREA        = no
         BGCOLOR            = ?
         FGCOLOR            = ?
         KEEP-FRAME-Z-ORDER = yes
         THREE-D            = yes
         MESSAGE-AREA       = no
         SENSITIVE          = YES.

IF SESSION:DISPLAY-TYPE = "GUI":U AND VALID-HANDLE(C-Win)
THEN C-Win:HIDDEN = NO.
  VIEW FRAME DEFAULT-FRAME IN WINDOW C-Win.
  VIEW FRAME FRAME-b IN WINDOW C-Win.
  C-Win.

ENABLE ALL WITH FRAME FRAME-B TITLE "".
ASSIGN FRAME FRAME-B:VISIBLE = FALSE. 

OS-DELETE VALUE(pass-txtout).
PAUSE 1 NO-MESSAGE IN WINDOW c-win.
OS-DELETE VALUE(pass-mergedoc).

pass-shelldoc = '"' + trim(pass-shelldoc) + '"'.
pass-shelldoc = TRIM(pass-shelldoc).

pass-txtfile = '"' + TRIM(pass-txtfile) + '"'.
pass-txtfile = TRIM(pass-txtfile).

pass-txtout = '"' + TRIM(pass-txtout) + '"'.
pass-txtout = TRIM(pass-txtout).

pass-mergedoc = '"' + TRIM(pass-mergedoc) + '"'.
pass-mergedoc = TRIM(pass-mergedoc).

DDE INITIATE sys FRAME FRAME FRAME-B:HANDLE APPLICATION "wpwin13_macros" TOPIC "COMMANDS".

/* create a wp doc from the pass-txtfile just created */
mline = "Application (WordPerfect; " + '"WordPerfect"' + '; Default!; "EN")'.
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "FileNew ()".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "ImportSetFileName (Filename: " + pass-txtfile + ")".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "ImportSetSource (SourceType: ASCII!)".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "ImportSetDestination (DestinationType: MergeData!)".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "ImportSetSizeToFit (State: No!)".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "ImportSetAsciiFieldDelimiter (FieldDelimiter: " + '"^"' + ")".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "ImportSetAsciiRecordDelimiter (RecordDelimiter: " + '"%"' + ")".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "ImportSetAsciiStrip (StripChars: " + '""' + ")".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "ImportSetAsciiEncap (EncapsulationChar: " + '"""' + '""' + ")".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "ImportDoImport ()".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "WAIT(10)".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "FileSave (Filename: " + pass-txtout + "; ExportType: WordPerfect_6_7_8!; yes!)".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "Close()".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

/* perform the merge using sheldoc, pass-txtout and pass-shelldoc */
mline = "Application (WordPerfect; " + '"WordPerfect"' + '; Default!; "EN")'.
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "MergeRUN(Formfile!;" + pass-shelldoc + ";DataFile!;".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = mline + pass-txtout + ";TOFILE!;" + pass-mergedoc + ")".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "CLOSE()".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

IF substring(pass-mergedoc,16,3) = "D12" THEN.
ELSE
    DO:
    mline = "FileOpen (Filename: " + pass-mergedoc + ")".
    mline = TRIM(mline).
    DDE EXECUTE sys COMMAND mline.

    mline = "AppMaximize ()".
    mline = TRIM(mline).
    DDE EXECUTE sys COMMAND mline.

    mline = "APPRESTORE ()".
    mline = TRIM(mline).
    DDE EXECUTE sys COMMAND mline.
    END.

DDE TERMINATE sys NO-ERROR.
 :
 :

My admin folks have encountered a big problem, and I'm relaying their plight to SO:

We have a legacy database application (written in Progress 4GL/OpenEdge) that invokes WordPerfect X3 in order to generate a report. The path to the WordPerfect executable is hard-coded within the database app, as well as the location of scanned PDFs that are to be inserted into the database, and we have no way to modify the program.

Most of our workstations have been successfully migrated from WinXP to Win7, and the legacy application works fine UNTIL it tries to invoke WordPerfect, saying it can't find the executable (even with X3 installed in the exact same path used on WinXP) ... same with the scanned document folder.

Any suggestions?


UPDATE:

I spent this morning helping my admin folks with the various suggestions you all provided ... we checked file permissions, looked at the compiled (.r) files with a Hex Editor (thanks @Tom and @Ernest), and did a search in files inside all source code (.p) with Notepad++.

Here's what I found: the program is NOT invoking WordPerfect directly (as I was originally informed), but instead is using DDE. Here's the error message that Progress 4GL produces:

DDE INITIATE Failed. (3153)

I am aware that there are issues with DDE and Win7, so I was wondering if there's a work-around, maybe registry keys that need to be modified or something to that affect.

I'm including an excerpt from the source code below, hoping that somebody recognizes what's going on (I'm NOT familiar with Progress 4GL, so it's all greek to me):

/* setup DDE communicaiton with WordPerfect 12   */
/* and perform the merge of the various document */

DEFINE VARIABLE sys             AS INTEGER NO-UNDO.
DEFINE VARIABLE mline           AS CHAR FORMAT "x(220)" NO-UNDO.
DEFINE VARIABLE intResult       AS INTEGER NO-UNDO.
DEFINE VARIABLE err-status AS INTEGER.

{GLOBVAR.I}
DEFINE VAR C-Win AS WIDGET-HANDLE NO-UNDO.

DEFINE FRAME FRAME-b
    WITH 1 DOWN KEEP-TAB-ORDER OVERLAY 
         SIDE-LABELS NO-UNDERLINE THREE-D 
         AT COL 13 ROW 4.1
         SIZE 11 BY 2
         TITLE "FRAMEWP".

IF SESSION:DISPLAY-TYPE = "GUI":U THEN
  CREATE WINDOW C-Win ASSIGN
         HIDDEN             = YES
         HEIGHT             = 4
         WIDTH              = 20
         MAX-HEIGHT         = 4
         MAX-WIDTH          = 20
         VIRTUAL-HEIGHT     = 4
         VIRTUAL-WIDTH      = 20
         RESIZE             = yes
         SCROLL-BARS        = no
         STATUS-AREA        = no
         BGCOLOR            = ?
         FGCOLOR            = ?
         KEEP-FRAME-Z-ORDER = yes
         THREE-D            = yes
         MESSAGE-AREA       = no
         SENSITIVE          = YES.

IF SESSION:DISPLAY-TYPE = "GUI":U AND VALID-HANDLE(C-Win)
THEN C-Win:HIDDEN = NO.
  VIEW FRAME DEFAULT-FRAME IN WINDOW C-Win.
  VIEW FRAME FRAME-b IN WINDOW C-Win.
  C-Win.

ENABLE ALL WITH FRAME FRAME-B TITLE "".
ASSIGN FRAME FRAME-B:VISIBLE = FALSE. 

OS-DELETE VALUE(pass-txtout).
PAUSE 1 NO-MESSAGE IN WINDOW c-win.
OS-DELETE VALUE(pass-mergedoc).

pass-shelldoc = '"' + trim(pass-shelldoc) + '"'.
pass-shelldoc = TRIM(pass-shelldoc).

pass-txtfile = '"' + TRIM(pass-txtfile) + '"'.
pass-txtfile = TRIM(pass-txtfile).

pass-txtout = '"' + TRIM(pass-txtout) + '"'.
pass-txtout = TRIM(pass-txtout).

pass-mergedoc = '"' + TRIM(pass-mergedoc) + '"'.
pass-mergedoc = TRIM(pass-mergedoc).

DDE INITIATE sys FRAME FRAME FRAME-B:HANDLE APPLICATION "wpwin13_macros" TOPIC "COMMANDS".

/* create a wp doc from the pass-txtfile just created */
mline = "Application (WordPerfect; " + '"WordPerfect"' + '; Default!; "EN")'.
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "FileNew ()".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "ImportSetFileName (Filename: " + pass-txtfile + ")".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "ImportSetSource (SourceType: ASCII!)".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "ImportSetDestination (DestinationType: MergeData!)".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "ImportSetSizeToFit (State: No!)".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "ImportSetAsciiFieldDelimiter (FieldDelimiter: " + '"^"' + ")".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "ImportSetAsciiRecordDelimiter (RecordDelimiter: " + '"%"' + ")".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "ImportSetAsciiStrip (StripChars: " + '""' + ")".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "ImportSetAsciiEncap (EncapsulationChar: " + '"""' + '""' + ")".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "ImportDoImport ()".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "WAIT(10)".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "FileSave (Filename: " + pass-txtout + "; ExportType: WordPerfect_6_7_8!; yes!)".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "Close()".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

/* perform the merge using sheldoc, pass-txtout and pass-shelldoc */
mline = "Application (WordPerfect; " + '"WordPerfect"' + '; Default!; "EN")'.
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "MergeRUN(Formfile!;" + pass-shelldoc + ";DataFile!;".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = mline + pass-txtout + ";TOFILE!;" + pass-mergedoc + ")".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

mline = "CLOSE()".
mline = TRIM(mline).
DDE EXECUTE sys COMMAND mline.

IF substring(pass-mergedoc,16,3) = "D12" THEN.
ELSE
    DO:
    mline = "FileOpen (Filename: " + pass-mergedoc + ")".
    mline = TRIM(mline).
    DDE EXECUTE sys COMMAND mline.

    mline = "AppMaximize ()".
    mline = TRIM(mline).
    DDE EXECUTE sys COMMAND mline.

    mline = "APPRESTORE ()".
    mline = TRIM(mline).
    DDE EXECUTE sys COMMAND mline.
    END.

DDE TERMINATE sys NO-ERROR.
 :
 :

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

风情万种。 2024-11-06 08:53:46

事实上,您“无法修改”的程序文件可以使用十六进制编辑器进行编辑;当年,这样的事已经做过很多次了。这些路径几乎肯定以可读文本格式位于二进制文件中。

除此之外,您可以在虚拟机映像(即 VMware 播放器)中运行 XP 并在其上安装程序;他们可能会更幸福。

The program file which you have "no way to modify" could, in fact, be edited with a hex editor; did that plenty of times, back in the day. The paths are almost certain to be sitting inside the binary file in readable text format.

Barring that, you could run XP inside a VM image (i.e., VMware player) and install the program on that; it them may be happier.

月寒剑心 2024-11-06 08:53:46

我同意这听起来很像权限问题。

尽管如此……你确定没有办法修改吗?这不是供应商通常提供的功能——它听起来更像是自定义修改。

您是否有 .p 或 .w 文件? (这些是 Progress 4GL 源代码。)还是只有 .r 文件? (这是编译后的代码。)

运行“showcfg”(开始菜单上的“config”图标)——如果您有开发许可证,则可能更多的是不知道如何更改它而不是没有能力更改它。

I agree that it sounds a lot like a permissions problem.

None the less... are you sure that you have no way to modify it? That isn't the sort of functionality that would typically be delivered by a vendor -- it sounds more like a custom modification.

Do you have .p or .w files hanging around? (These are Progress 4GL source code.) Or only .r files? (This is the compiled code.)

Run "showcfg" (the "config" icon on the start menu) -- if you have development licenses it may be more a case of not knowing how to change it than not having the ability to change it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文