Click here to Skip to main content
15,910,981 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Help Please : CPU usage stays at 100% Pin
Jon Hulatt30-Jan-02 23:23
Jon Hulatt30-Jan-02 23:23 
GeneralSolved Pin
Ganesh Ramaswamy31-Jan-02 3:32
Ganesh Ramaswamy31-Jan-02 3:32 
QuestionIs there a way to play resource Avi's using directshow? Pin
Bart-Man30-Jan-02 10:03
Bart-Man30-Jan-02 10:03 
GeneralMDI stupid question.... Pin
Philip Patrick30-Jan-02 9:50
professionalPhilip Patrick30-Jan-02 9:50 
GeneralRe: MDI stupid question.... Pin
Joaquín M López Muñoz30-Jan-02 10:21
Joaquín M López Muñoz30-Jan-02 10:21 
GeneralRe: MDI stupid question.... Pin
Philip Patrick30-Jan-02 11:11
professionalPhilip Patrick30-Jan-02 11:11 
GeneralInterthread messaging Pin
30-Jan-02 9:20
suss30-Jan-02 9:20 
GeneralRe: Interthread messaging Pin
Joaquín M López Muñoz30-Jan-02 9:45
Joaquín M López Muñoz30-Jan-02 9:45 
Since all your threads are instances of the same class (let's call it CMyUIThread) the simplest solution is maintaining a static list of all active threads and let a method multiplex message posting to all of them. Scheme follows:
class CMyUIThread: public CWinThread
{
  public:
    CMyUIThread()
    {
      // some synchronization code could be needed here
      activeThreads.insert(this);
    }
    ~CMyUIThread()
    {
      // some synchronization code could be needed here
      activeThreads.erase(this);
    }
  protected:
    static void BroadCastMessage(UINT Msg,WPARAM wParam,LPARAM lParam)
    {
      for(activeThreadsIterator it=activeThreads.begin();it!=activeThreads.end();++it){
        it->PostThreadMessage(Msg,wParam,lParam);
      }
    }
  private:
    static std::set<CMyUIThread*> activeThreads;
    typedef std::set<CMyUIThread*>::iterator activeThreadsIterator;
};
This code is merely an indication (it probably won't even compile), but hopefully you're getting the idea: when a thread wants to broadcast a message, it simply calls BroadCastMessage, which does the dirty job of posting to all threads one by one. Regards.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
GeneralRe: Interthread messaging Pin
30-Jan-02 10:09
suss30-Jan-02 10:09 
GeneralRe: Interthread messaging Pin
Joaquín M López Muñoz30-Jan-02 10:17
Joaquín M López Muñoz30-Jan-02 10:17 
Generaltrying to clear History from IE Pin
TigerNinja_30-Jan-02 8:58
TigerNinja_30-Jan-02 8:58 
GeneralAccessing Excel Cells from Visual C++ Pin
Havoc30-Jan-02 7:13
Havoc30-Jan-02 7:13 
GeneralRe: Accessing Excel Cells from Visual C++ Pin
Richard Ellis30-Jan-02 12:14
Richard Ellis30-Jan-02 12:14 
GeneralRe: Accessing Excel Cells from Visual C++ Pin
wangyiming30-Jan-02 14:33
wangyiming30-Jan-02 14:33 
QuestionBad Coding? Pin
James R. Twine30-Jan-02 6:42
James R. Twine30-Jan-02 6:42 
AnswerRe: Bad Coding? Pin
Roger Allen30-Jan-02 6:56
Roger Allen30-Jan-02 6:56 
GeneralRe: Bad Coding? Pin
James R. Twine30-Jan-02 7:04
James R. Twine30-Jan-02 7:04 
AnswerRe: Bad Coding? Pin
Igor Proskuriakov30-Jan-02 7:15
Igor Proskuriakov30-Jan-02 7:15 
GeneralRe: Bad Coding? Pin
James R. Twine30-Jan-02 8:48
James R. Twine30-Jan-02 8:48 
AnswerRe: Bad Coding? Pin
Chris Losinger30-Jan-02 9:02
professionalChris Losinger30-Jan-02 9:02 
AnswerRe: Bad Coding? Pin
Joaquín M López Muñoz30-Jan-02 9:08
Joaquín M López Muñoz30-Jan-02 9:08 
GeneralChange the date of file! Pin
Mazdak30-Jan-02 6:14
Mazdak30-Jan-02 6:14 
GeneralRe: Change the date of file! Pin
Ravi Bhavnani30-Jan-02 6:24
professionalRavi Bhavnani30-Jan-02 6:24 
Generalstring usage problem Pin
30-Jan-02 6:00
suss30-Jan-02 6:00 
GeneralRe: string usage problem Pin
Joaquín M López Muñoz30-Jan-02 7:51
Joaquín M López Muñoz30-Jan-02 7:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.