> Francois, what is the best way to handle this one? I can set a 'flag' within
> the LocationChange handler and use it to Abort the client at a later moment
> (or discard its content etc). I've also seen people talk about using
> PostMessage but I'm not sure how to do that. How would I create a message
> and use a handle for the processing object? (my own 'download-manager'
> object for instance).

To use PostMessage, you must :
1) Declare a unique constant which is the message number
      const WM_MY_MSG = WM_USER + 123;  // Select a unique number !
2) Declare a message handler in the form where you dropped the component
      procedure WMMyMsg(var msg: TMessage); message WM_MY_MSG;
3) Implement the procedure to do what you need to do:

      procedure TForm1.WMMyMsg(var msg: TMessage);
          // Whatever you need
4) Then you may PostMessage from anywhere
     PostMessage(Form1.Handle, WM_MY_MSG, myWParam, myLParam);

It is frequently conveniant to pass a component reference in one of the message 
parameters and
anything else you like in the other. You must cast it to LParam or WParam.
     PostMessage(Form1.Handle, WM_MY_MSG, 0, LParam(HttpCli1));
in the handler:
     HttpClient := THttpCli(msg.LParam);

Be aware to not destroy the component before the posted messages are handled ! 
If you need to
destroy the component, then you must keep track of resulting invalid 
references. For example
maintain a list of components, give an ID to each one. When you postmessage, 
you check if the
reference (LParam) is still in the list with same ID (WParam).

There are a lot of example of message posting in all ICS components.

Contribute to the SSL Effort. Visit
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)

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