🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #12227

error invlid handle when trying to postthreadmessage

#12227
From: Mark Di Nicola
Date: Tue, 16 Dec 2003 23:59
53 lines
2545 bytes
the following code works fine on all the computers i've installed my 
program on bar one. its running windows xp pro. the problem is i keep on 
getting error posting message: error invalid thread id. on all other 
computers it works fine and some of them also run xp pro.

if (tThread) {
     if (!PostThreadMessage(tThread->ThreadID, TH_INCOMING, NULL, NULL))
        Log("Error Posting Message: " + SysErrorMessage(GetLastError()));
}

in the thread i then have...

  while (!Terminated) {
        MSG Msg;
        ZeroMemory(&Msg, sizeof(MSG));
        if (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)) {
           switch (Msg.message) {
                  case TH_ALL:
                       ManualCheckNow();
                       ManualSendNow();
                       break;
                  case TH_INCOMING:
                       ManualCheckNow();
                       break;
                  case TH_OUTGOING:
                       ManualSendNow();
                       break;
                  case TH_SENDORDER:
                       SendOrder();
                       break;
                  case TH_UPDATEINC:
                       NextIncomingCheckTime();
                       break;
                  case TH_UPDATEOUT:
                       NextOutgoingCheckTime();
                       break;
                  case TH_XMLSEND:
                       XmlSend();
                       break;
           };
        }

        if (Main_Form->Dialled)
           Main_Form->RasDial->Disconnect();

        CatchUp();

        ::Sleep(0);
  }

any ideas?

TIA
Technical Details
Message-ID: <3fdf9bb2$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,6e41c9ea28efb76e,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-12-16 16:10:02 PST
Date: Wed, 17 Dec 2003 10:59:45 +1100
From: Mark Di Nicola <don't@emailback.com>
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5) Gecko/20031007
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: error invlid handle when trying to postthreadmessage
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 220.240.226.12
Message-ID: <3fdf9bb2$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1071618994 220.240.226.12 (16 Dec 2003 15:56:34 -0700)
Lines: 54
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail