Delphi 多线程应用程序内置于 vista 中,无法在 XP 中运行 [英] Delphi multithreaded application built in vista and won't run in XP

查看:42
本文介绍了Delphi 多线程应用程序内置于 vista 中,无法在 XP 中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很难过.

我在 vista 上运行 delphi 2007.我已经构建了许多应用程序并在 XP 中运行它们没有问题.这个最新的应用程序必须使用线程.我很确定我的代码是正确的.它在 Vista 上运行良好,但是当我在 XP(尝试了多台 PC)上运行它时,我的程序似乎滞后(操作系统的 32 位、XP sp3 和 Vista sp1、dotnet v2).最好的例子是,如果我拔掉串行端口,我的 coms 将继续运行等.

I am running delphi 2007 on vista. I have built many applications and run them in XP with no problem. This latest app had to make use of threads. I'm pretty sure my code is correct. It runs fine on Vista, but when I run it on XP (tried multiple PC's) my program seems to lag (both os's 32 bit, XP sp3 and Vista sp1, dotnet v2). Best example being if I unplug the serial port my coms will continue to run etc.

我在我的 xp 机器上安装了 delphi,并在 delphi 运行时运行了我的程序.就像我从vista中内置的exe运行它一样.那时它运行良好.关闭 delphi,通讯再次开始滞后.

I was installing delphi on my xp machine, and ran my program while delphi was running. As in I ran it from the exe built in vista. It ran fine then. Close delp and the comport starts to lag again.

如果我拔下并重新插入闪存驱动器,通讯会再次赶上.

If I unplug and replug a flash drive, the coms catches up again.

我想在我的基于 xp 的机器上构建应用程序,但有大约一百万个 3rd 方组件,这使它成为一个真正的设置任务.

I want to build the app on my xp based machine, but have like a million 3rd party components that makes it a real mission to setup.

哦,仅供参考,我构建了一个只有主线程和一个通信线程的简单应用程序.同样的问题.comthread 要做的就是从comport 中获取数据.甚至没有显示它,我在后台使用了一个串口监视器来检查延迟.

Oh fyi, i built a simple application with just the main thread, and a comport thread. Same problem. All the comthread will do is fetch data off the comport. Not even display it, i used a serial port monitor in the background to check for the lag.

欢迎提出任何建议.

OK 快速XP 电脑是全新构建的.我打开msn messenger,程序运行正常.我显然缺少一些设置...

OK quick edit: the XP pc is freshly built. I opened msn messenger, and the program runs fine. I'm obviously missing some setting...

推荐答案

如果你在你的线程中使用 Sleep (因此我对你的问题的评论/查询),您应该使用 timeBeginPeriod 来指示您想要的分辨率.正如您已经发现的那样,在何处调用它并不重要;可以是主线程,也可以是完全不同的应用程序.

If you're using Sleep in your threads (hence my comment/query to your question), you should use timeBeginPeriod to indicate your desired resolution. As you've already found out it doesn't matter where you call it; can be the main thread or even an entirely different application.

在 embarcadero 论坛上查看此主题,当然还有文档(备注)在 MSDN 上.

See this thread on embarcadero forums, and of course the documentation (remarks) on MSDN.

这篇关于Delphi 多线程应用程序内置于 vista 中,无法在 XP 中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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