WAR: DS / SS for windows WIZARD

My multi-threader, of course, has a stack which is not part of the data
segment.  In some instances this is important (WHEN WHEN? I don't know?)

I have noticed a problem when a thread tries to update a windows standard
control, such as TRadioButton.

There is an exception error, which I traced with the VCL source.
It seems the problem occurs BEFORE the error; I beleive the problem occurs
in the SendMessage function.  When the program calls sendmessage, DS and
SS are different, but inside the WindowProc, DS has taken on the value of SS.

Then finally, in the snippet shown below, a GPF happens at the end of the
chain of WindowProc's.

Has windows been presumptuous in taking on the value of SS into DS?
Mayhap it corrupted DS thinking to restore it from SS?

Is the cure to use the windows function SwitchStackTo to change to a DS
styled stack, just for the duration of the call?

{ In FORMS.PAS }

procedure TForm.DefaultHandler(var Message);
begin
  if ClientHandle <> 0 then
    with TMessage(Message) do
      if Msg = WM_SIZE then
        Result := DefWindowProc(Handle, Msg, wParam, lParam) else
        Result := DefFrameProc(Handle, ClientHandle, Msg, wParam, lParam)
  else
    inherited DefaultHandler(Message)
end;  { ************* This line causes the GPF }

function StdWndProc(Window: HWND; Message: Word; WParam: Word;
  LParam: Longint): Longint; export; assembler;
asm

{ In this procedure DS takes on the value of SS }
{ When the message was sent with SendMessage DS and SS were different }

--
Sam Liddicott                                  
Campbell Scientific Ltd.                        
14-20 Field Street, Shepshed,                  
Leicestershire,                            Phone: +44 (0) 1509 601141
United Kingdom. LE12 9AL                   Fax:   +44 (0) 1509 601091