无法再启动 16 位应用程序

发布于 2024-08-31 15:18:09 字数 620 浏览 3 评论 0原文

我正在尝试调试和解决用 C++ 编写的 Win32 宏应用程序的一些问题,但是我遇到了最奇怪的问题。

我必须启动一个 16 位程序,然后模拟输入数据,并且已经使用 ShellExecute 两年多了。我根本没有接触过这个实际代码,但现在它不起作用。

我正在执行 ShellExecute(NULL, "open", exe_path.c_str(), NULL, "", SW_SHOWDEFAULT);。这多年来一直完美无缺,但突然间,它不再起作用了。它给了我一个 ACCESS_DENIED 错误代码。我用 Google 搜索了一下,显然这是启动 16 位应用程序时很常见的问题。

工作站XP SP2的环境完全没有改变,直到不久前我重新搭建过才真正可以工作(之前已经重新搭建过很多次了)。

该代码位于窗口过程函数内部,当我将其取出并在 WinMain 函数中启动该程序时,它可以工作,但代码必须位于窗口过程函数中...

我尝试了多种替代方法,但它们都给出了相同的结果问题。

最大的问题是它正在工作,然后突然决定在不更改代码和环境的情况下它不会工作!事实上,大约在测试更改的一半时,它就开始工作了。以为它会停止工作。

请帮忙,因为如果不启动程序我就无法做任何事情。这是我正在调试的代码的第一步!

I'm trying to debug and resolve some issues with a Win32 macro application written C++ however I'm having the strangest issue.

I have to launch a 16-bit program and then simulate entering data into and have been using ShellExecute for over two years now. I haven't touched this actual code at all, but now it doesn't work.

I'm doing ShellExecute(NULL, "open", exe_path.c_str(), NULL, "", SW_SHOWDEFAULT);. This has worked flawlessly for years but all of sudden, it stopped working. It gives me an ACCESS_DENIED error code. I've Googled and apparently this is a pretty common issue with launching 16-bit apps.

The workstation XP SP2 environment hasn't changed at all, and it was actually working until I rebuilt a little while ago (I've rebuilt it before many times).

The code is inside a window procedure function and when I take it out and launch the program in the WinMain function it works, but the code has to be in the window procedure...

I've tried numerous alternatives but they all give the same issue.

The biggest issue with this is it was working then all of a sudden decided it wasn't going to with no change to both code and environment! In fact, it was about half way through testing changes that it thought it'd stop working.

Please help as I cannot do anything without the program launching. It's the first step in the code that I'm debugging!

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

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

发布评论

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

评论(1

断念 2024-09-07 15:18:09

我已经发现了这个问题。我使用 PathRemoveFileSpec 将 lpDirectory 参数(其中我提供了 NULL"")更改为可执行文件的目录() 函数。

该应用程序正在再次启动。 现在我可以继续修复程序的其余部分

I've discovered the issue. I changed the lpDirectory parameter (of which I was supplying NULL or "") to the directory of the executable, using the PathRemoveFileSpec() function.

The application is launching again. Now I can continue fixing the rest of the program!

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