🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.multimedia
Article #200

Re: CALLBACK_THREAD

#200
From: Isaac
Date: Wed, 28 May 2008 03:53
71 lines
2890 bytes
Hi, thanks for your prompt reply.

I've three units.

Unit1:  the main application
Unit2:  playback thread (which uses the code tidbits above)
Unit3:  record thread

I thought that it may not be as simple as putting ThreadID in
the parameters of waveOutOpen; that by doing so the messages
were actually being sent to the main application instead.

So I wrote a function that sets the thread ID to test this
(but no joy as well).

   Unit1.cpp ===================================================
      __fastcall TForm1::TForm1(TComponent* Owner)
                        : TForm(Owner) {
         playWave = new LineOut(false);
         playWave->SetThreadID(playWave->ThreadID);
         ...
         ..
         .
      }

   Unit2.cpp ===================================================
      void __fastcall LineOut::SetThreadID(int temp) {
         myThreadID = temp;
      }
      ----------------------------------------------------------
      __fastcall LineOut::LineOut(bool CreateSuspended)
                         : TThread(CreateSuspended) {
         ...
         ..
         .
         waveOutOpen(&WaveHandle,
                     WAVE_MAPPER,
                     &WaveFormat,
                     (double)myThreadID,
                     (double)this,
                     CALLBACK_THREAD)

         ...
         ..
         .
      }
      ----------------------------------------------------------
      void __fastcall LineOut::OnWaveMessage(TMessage &msg) {
         if(msg.Msg == MM_WOM_DONE) {
           // Do something
         }
      }

   Unit2.h =====================================================
      public:
         BEGIN_MESSAGE_MAP
            MESSAGE_HANDLER(WOM_DONE, TMessage, OnWaveMessage)
         END_MESSAGE_MAP(TThread)


WOM_DONE or MM_WOM_DONE are still not being handled.

Is there something about threads and messages that I should
read about?  I searched the net for some clue from a similar
setup to mine with zero success.


I'll lookup TApplication::OnMessage, thanks!

Isaac
Technical Details
Message-ID: <483cd729$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <483c134e$1@newsgroups.borland.com> <483c719a$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10d0fc,c44ef3876ed33b54
X-Google-Attributes: gid10d0fc,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Isaac" <nospam@nospam.com>
Sender: "Isaac" <nospam@nospam.com>
Reply-To: "Isaac" <nospam@nospam.com>
Subject: Re: CALLBACK_THREAD
Newsgroups: borland.public.cppbuilder.multimedia
X-User-Info: 121.44.2.5     
References: <483c134e$1@newsgroups.borland.com> <483c719a$1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <483cd729$1@newsgroups.borland.com>
Date: 27 May 2008 20:53:13 -0700
X-Trace: newsgroups.borland.com 1211946793 207.105.83.66 (27 May 2008 20:53:13 -0700)
Lines: 71
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail