线程错误与否? [英] Thread error or not?

查看:68
本文介绍了线程错误与否?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



使用我的远程桌面程序,我有:

1)一个线程上的一个接收器用于我和我之间的主要消息远程计算机

2)一个线程上有一个接收器,用于接收来自远程计算机的屏幕截图并将它们放在一个图片盒中



我用过我的一些调试技术可以说明从我到远程计算机的消息,告诉它开始在按钮上发送屏幕截图点击工作。

我在管理员端使用msgbox确认远程计算机收到启动命令。令我惊讶的是,当msgbox弹出时,图像开始显示。但是当我确定msgbox时,没有更多的图像通过。这是一个向主UI线程调用(或类似的东西)的情况吗? (我认为当主接收器正在处理某些东西时图像会卡住。)



总而言之,它只适用于msgboxes将焦点从表单上移开的情况。



有谁知道我可以做些什么来解决这个问题?



-Ricky

Hello,

With my remote desktop program I have:
1) one receiver on one thread for main messages between me and the remote computer
2) one receiver on one thread for receiving screenshots from the remote computer and placing them in a picturebox

I have used several of my debugging techniques to single out that the message from me to the remote computer telling it to begin sending screenshots on a button click DOES work.
I used a msgbox on the administrator side to confirm that the remote computer received the start command. To my surprise, images starting being displayed when that msgbox popped up. But when i ok'd the msgbox, no more images came through. Is this a case of invoking (or something like that) to the main UI thread? (I'm thinking that the images get stuck when the main receiver is processing something.)

To summarise, it only works when msgboxes take focus away from the form.

Does anyone know anything I can do to fix this?

-Ricky

推荐答案

没有看到代码,就无法回答你的问题了。



但是,我怀疑你是在创造从后台线程显示和触摸PictureBox控件的位图,这将永远不会工作。您必须必须创建位图并将其分配给UI(启动)线程上的PictureBox。



...并且,正如您已经被告知的那样,如果你正在制作自己的RemoteDesktop应用程序,那么你的做法非常错误。
Without seeing the code, it's impossible to answer your question.

But, my suspicions are the you're creating the bitmap to display and touching the PictureBox control from the background thread, which will never work. You MUST MUST MUST create the bitmap and assign it to the PictureBox on the UI (startup) thread.

...and, as you've already been told, if you're making your own RemoteDesktop app, you're doing it the very wrong way.


这篇关于线程错误与否?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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