No genius idea pops up from my head :-(
--
[EMAIL PROTECTED]
http://www.overbyte.be

----- Original Message ----- 
From: "Arno Garrels" <[EMAIL PROTECTED]>
To: "ICS support mailing" <twsocket@elists.org>
Sent: Monday, June 12, 2006 12:29 PM
Subject: Re: [twsocket] Enhancements for Thread Attach/Detach methods


> Francois PIETTE wrote:
> > You must map
> > old message numbers to the new message numbers before posting them to
> > the new window.
> 
> I do not see how to map those numbers on a low level easily :( any idea? 
> 
> 
> > 
> > --
> > [EMAIL PROTECTED]
> > http://www.overbyte.be
> > 
> > 
> > ----- Original Message -----
> > From: "Arno Garrels" <[EMAIL PROTECTED]>
> > To: "ICS support mailing" <twsocket@elists.org>
> > Sent: Sunday, June 11, 2006 3:18 PM
> > Subject: Re: [twsocket] Enhancements for Thread Attach/Detach methods
> > 
> > 
> >> Francois PIETTE wrote:
> >>>> In V6, how can I extract messages of the to be detached socket
> >>>> only? Is it Peekmessage(Msg, OldHWnd, MsgLow, MsgLow + MsgCnt,
> >>>> PM_REMOVE)? 
> >>> 
> >>> No. This would retrieve all messages for all component sharing the
> >>> same TIcsWndHandler.
> >>> It is necessary to iterate thru FMsgMap to find all occurence of
> >>> self and get the corresponding message numbers (see
> >>> TIcsWndHandler.AllocateMsgHandler) to use in PeekMessage. It is not
> >>> guaranteed that all messages numbers for a given component are
> >>> contiguous altough it will most of the time.
> >>> 
> >>> The problem is to retrieve all message from the old queue and post
> >>> them in the new queue in the same order. This can be solved by
> >>> examining the time member in TMsg record.
> >> 
> >> Can you please help me? Something like below, or do I still haven't
> >> got it fully?
> >> 
> >> procedure TIcsWndControl.MoveQueuedMessages(NewHwnd: HWND);
> >> var
> >>    I   : UINT;
> >>    Idx : Integer;
> >>    Msg : tagMsg;
> >>    P   : PMsg;
> >>    L   : TList;
> >> 
> >>    function CmpFunc(Item1: Pointer; Item2: Pointer): Integer;
> >>    begin
> >>        if PMsg(Item1)^.time = PMsg(Item2)^.time then
> >>            Result := 0
> >>        else if PMsg(Item1)^.time > PMsg(Item2)^.time then
> >>            Result := 1
> >>        else
> >>            Result := -1;
> >>    end;
> >> 
> >> begin
> >>    L := TList.Create;
> >>    try
> >>        I := 0;
> >>        while I < WH_MAX_MSG do
> >>        begin
> >>            if FWndHandler.FMsgMap[I] = Self then
> >>            begin
> >>                while PeekMessage(Msg, Handle, I +
> >> FWndHandler.FMsgLow,                                  I +
> >> FWndHandler.FMsgLow, PM_REMOVE) do                begin
> >>                    New(P);
> >>                    //P^.hwnd      := Msg.hwnd;
> >>                    P^.message   := Msg.message;
> >>                    P^.wParam    := Msg.wParam;
> >>                    P^.lParam    := Msg.lParam;
> >>                    P^.time      := Msg.time;
> >>                    L.Add(P);
> >>                end;
> >>            end;
> >>            Inc(I);
> >>        end;
> >>        L.Sort(@CmpFunc);
> >>        for Idx := 0 to L.Count - 1 do
> >>            PostMessage(NewHwnd, PMsg(L[Idx])^.message,
> >> PMsg(L[Idx])^.wParam,
> >>                        PMsg(L[Idx])^.lParam);
> >>    finally
> >>        for Idx := 0 to L.Count - 1 do
> >>            System.Dispose(L[IDX]);
> >>        L.Free;
> >>    end;
> >> end;
> >> 
> >> 
> >> 
> >> 
> >>> --
> >>> [EMAIL PROTECTED]
> >>> http://www.overbyte.be
> >>> 
> >>> 
> >>> 
> >>> ----- Original Message -----
> >>> From: "Arno Garrels" <[EMAIL PROTECTED]>
> >>> To: "ICS support mailing" <twsocket@elists.org>
> >>> Sent: Sunday, June 11, 2006 9:49 AM
> >>> Subject: Re: [twsocket] Enhancements for Thread Attach/Detach
> >>> methods 
> >>> 
> >>> 
> >>>> Francois PIETTE wrote:
> >>>>>> AFAIK winsock API function WSAAsyncSelect() is a common, blocking
> >>>>>> function. In this case it's called to disable winsock
> >>>>>> notifications. Because the window is detached/destroyed in
> >>>>>> subsequent lines. BTW: Same is done in V5.
> >>>>>> So for a short while the detached socket is windowless, that's
> >>>>>> why I suggested to wait w/o processing messages until it is
> >>>>>> attached again (not nice but worked for me).
> >>>>> 
> >>>>> To be safe, the order should be:
> >>>>> 1) Stop notifications from winsock (WSAAsyncSelect) to the current
> >>>>> (old) hidden window
> >>>>> 2) Create the new hidden window
> >>>>> 3) Extract all messages from old hidden window queue and push them
> >>>>> to the new queue
> >>>> 
> >>>> In V6, how can I extract messages of the to be detached socket
> >>>> only? Is it Peekmessage(Msg, OldHWnd, MsgLow, MsgLow + MsgCnt,
> >>>> PM_REMOVE)? 
> >>>> 
> >>>> ---
> >>>> Arno Garrels [TeamICS]
> >>>> http://www.overbyte.be/eng/overbyte/teamics.html
> >>>> 
> >>>> 
> >>>> 
> >>>>> 4) Restart notifications from winsock to the new hidden window
> >>>>> 
> >>>>> Probably a good idea to post a FD_READ message in the new queue
> >>>>> between 3 and 4 above. Because it may happend that data has been
> >>>>> received during the time interval when notifications have been
> >>>>> disabled.
> >>>>> 
> >>>>> --
> >>>>> [EMAIL PROTECTED]
> >>>>> http://www.overbyte.be
> >>>> --
> >>>> To unsubscribe or change your settings for TWSocket mailing list
> >>>> please goto http://www.elists.org/mailman/listinfo/twsocket
> >>>> Visit our website at http://www.overbyte.be
> >> --
> >> To unsubscribe or change your settings for TWSocket mailing list
> >> please goto http://www.elists.org/mailman/listinfo/twsocket
> >> Visit our website at http://www.overbyte.be
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to