“正在处理,请稍候”屏幕有螺纹?
也许,这对你来说很容易,但我正在努力开发一个项目(出于教育目的),该项目使用 TADSISearch 组件查询 adsi,持续了几天。当 TADSISearch 搜索 Active Directory 时,我试图在 Form2 上显示“正在工作,请稍候...”闪屏,其中包含一个男工动画 gif。虽然我根据自己的想法尝试了所有的可能性,但我没有成功。我尝试在线程中使用 TADSISearch,但线程在 ADSIsearch 完成之前终止。我认为 TADSISearch 不是线程安全的。你怎么认为?另外,我创建了 Form2 并使用线程来更新它的另一种方法,但动画 gif 停止了,而主窗体已经进行了 adsi 搜索。对于这些你有什么想说的吗?我怎样才能在 ADSISearch 工作时制作一个请等待屏幕并保持主表单响应。 Application.ProcessMessages 或计时器也不是一种方法。非常感谢您的阅读和回答。
Perhaps, it is very easy for you, but I am hard working on a project (for educational purposes) that is querying adsi with TADSISearch component, for several days. I'm trying to show a 'Working, Please wait..' splash screen with a man worker animated gif on Form2 while TADSISearch is searching the Active Directory. Although i tried every possibilities according to me, but i couldn't succeed. I tried to use TADSISearch in a thread, but thread is terminating before ADSIsearch finishes. I think TADSISearch is not thread safe. What do you think? Also, another way that I created Form2 and used a thread for updating it but the animated gif is stopping while main form gone adsi searching. What can you say about these? How can i make a please wait screen while ADSISearch is working and keep main form responding. Application.ProcessMessages or timer is not a way too. Thanks a lot for reading and answers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
图形用户界面应由主线程更新。您应该将搜索代码放入单独的线程中,当搜索器线程工作时,您的主线程可以显示动画以及“请稍候”消息。
当通过任何可用的同步技术完成搜索时,您的搜索器线程可以通知主线程。最简单的方法是在线程类中定义一个方法来停止用户界面中的动画,并将该方法传递给搜索器线程的 Execute 方法末尾的 Synchronize。
您的搜索线程代码将如下所示:
您的主线程代码将如下所示:
The graphical user interface should be updated by the main thread. You should put your search code into a separate thread, and while the searcher thread is working, your main thread can show the animation along with "Please wait" message.
Your searcher thread can notify the main thread when search is done by any of the available synchronization techniques. The simplest one is to define a method in your thread class which stops the animation in user interface, and pass that method to Synchronize at the end of Execute method of your searcher thread.
Your searcher thread code will be something like this:
And your main thread's code will be like this:
也许你可以尝试这个:
Threaded Splashscreen for Delphi
http://cc.embarcadero.com/Item/20139
我在触摸屏上使用它/终端应用程序(瘦客户端、Wifi、RemObjects 等),效果很好!
还得到了一个 gif 动画。
Maybe you can try this:
Threaded Splashscreen for Delphi
http://cc.embarcadero.com/Item/20139
I use this on a touchscreen/terminal application (thin client, Wifi, RemObjects, etc) and it works nice!
Also got an animated gif working.
线程如何在搜索完成之前终止?如果搜索是在线程中执行的,并且您只有一个线程实例,那么它应该可以工作。
How can the thread terminate before the search is finished? If the search is executed in the thread and you have only one instance of the thread it should work.
你能不能只
在 TMyWaitForm(它会自动显示)上放置一个动画 GIF?
在我的网络创建程序中构建网站时,我有一个进度表,这就像一个魅力。
您甚至可以考虑在等待表单上显示一些状态信息(如果 TADSISearch 组件/软件具有可以分配的回调函数或事件)。
显示一个运行时钟,显示该过程所花费的时间,也是一个不错的选择。
Can you not just do a
Putting an animated GIF on the TMyWaitForm (which displays itself) ?
I have a progress form when building websites in my web creation program, and this works like a charm.
You even may consider showing some state information on the wait form (if the TADSISearch component/software has a call back function or event which can be assigned).
Displaying a running clock showing the amount of time the process is taking, is also a nice touch.