Multithreaded user interface in windows


















The content you requested has been removed. Ask a question. Quick access. Search related threads. Remove From My Forums. Answered by:. Archived Forums.

Windows Forms General. Sign in to vote. Hello, I want to implement a multi threaded user interface but I have some problems. I have Form1 with a listbox, and a void that calls a web service for building a collection of objects that will be the datasource for the listbox. On Load event of Form1 I create a new thread that use this void. In the void I have an instruction that sets the datasource fot the listbox, but I recieve an error that tells me that the listbox control belongs to a different thread.

Can you give me some directions to solve this problem? For most applications it is just a gimmick, because users do not read very fast.

Most of the time it is better to design a different approach to showing logs, perhaps a stateful UI to let user choose what is interesting to him at the moment. You can have a look at their source code.

Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Handling user interface in a multi-threaded application or being forced to have a UI-only main thread Ask Question. Asked 11 years, 10 months ago. Active 11 years, 8 months ago.

Viewed times. I solved this problem by having a maximum size on the communication buffer, but then I run into a problem in the following situation: the main thread has to perform a complex action the main thread takes some parts of the action and let's separate threads execute this while the seperate threads are executing their logic, the main thread processes the results from the other threads and continues with its work if the other threads are finished Problem is that in this situation, if the other threads perform logging, there is no UI-message loop, and so the communication buffer is filled, but not emptied.

I see two solutions in solving this problem: require the main thread to do regular polling of the communication buffer only performing user interface logic in the main thread no other logic I think the second solution seems the best, but this may not that easy to introduce in a big application in my case it performs mathematical simulations.

Thanks, Patrick. Jon Seigel Patrick Patrick Add a comment. Active Oldest Votes. Let's make some order first. A simple thread function looks like. Copy Code. Selvam R. He takes a lot of interest in reading technical articles and enjoys writing them too.

First Prev Next My vote of 3 venkat. KirowOnet 5-Dec Selvam R 3-Feb GC 9-Sep Selvam R 9-Sep Member Jun KarstenK Jun C Dec Selvam R May Maryam Kasravi May Go to top. Layout: fixed fluid. First Prev Next. My vote of 3 venkat. My vote of 2 ranjithkumar81 Dec Hi Selvam, I have some query, related to multithreading. I am able to create a multithred using afxbeginthread ,But each thread suppose to perform different task. Example : 1 insert the data into database and another one read the data from database.

Please give some examples. My vote of 5 zssure Aug It is useful for me to learn about the working threads and UI threads. My vote of 5 KirowOnet 5-Dec It works without dancing with a tambourine. Help: Creating a thread GC 9-Sep I have read through the various postings and tried to put some code together but it won't compile. I am trying to start the new thread from a menu item via a message handler based in my application's 'CView' based class.

Priority in Threading k. Now i am learning threading concepts. I executed following code segment in MFC Project. There is no error in program. It's executing but the output wrongly get stored in test. But it's not correctly working. I expected the output to print values in the file test. May u clearly give the definition of thread priority and how to use in my program to achieve the output what i expected Write strValue,strValue.

Member Inside the dll there a StartCapture funtion that creates a Audio capture graph by calling a BuildGraph funtion and then it starts a thread "CaptureThread". Now in my application i am calling an interface of my above COM Dll. So now ,if i call StartCapture from my application multiple times , will it create multiple CaptureThread and ProcessThread?

How ll it behave? I have not worked much with threading , so need help. I dont know how it works.



0コメント

  • 1000 / 1000