Best way to retrieve very long strings from thread pool

Flaviu_ 1,031 Reputation points
2024-12-05T16:37:38.1766667+00:00

I have a MFC SDI app. I have a thread pool in the document class. The threads retrieve very long strings. My question: how can I get those strings from the threads?

I want to avoid save them to HDD files, or inside a database. Any ideas?

Developer technologies | C++
{count} votes

Accepted answer
  1. RLWA32 49,636 Reputation points
    2024-12-06T12:35:53.4066667+00:00

    You could use a custom windows message. The thread pool callback function could post the message to your MFC application's hwnd. The WPARAM could contain the number of characters in the string and the LPARAM could be a pointer to the string. Of course the way that the message handler processes the custom message depends on what the LPARAM points to. A raw pointer to memory allocated by new or malloc? A pointer to a CString object? A pointer to a std::string object? And so forth.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.