Hi Adam, > Hi - after pulling out a lot of hair
Hopefully you have some reserve :) > I've spent the last couple of days tinkering with the DLL 1 example but DLL is not different from other. Only think is if you write a DLL you maybe don't know who call it. Maybe a programmer will use the DLL wich has no knowledge of message pump or the way windows work. Maybe you have to write your own message pump in that case. > Connect() needs to be passed the host, the port, the username, the If you have a working message pump then after a connection then OnSessionconnected will fire. Then you have it all. > What I need Connect() to do is kick off a worker thread that continues > running and manages the socket connection without blocking the calling > process as the current DLL example does. I'm not sure wy do you need a separate worker thread? > 2) SendStr() the username SendStr is what you can do in the OnSessionConnected event > .then sit in a loop where it: You don't need a loop! TWSocket is event driven (fortinatly) > 3) Monitors for incoming messages and adds each message to a > TStringList Every receved data you can add. Note that TCP is NOT package bound garantie. > 4) Fires off a PostMessage() to the specified window of the main > application every "pump rate" milliseconds You can give the handle to the window to the DLL from the calling application. > Connected() simply returns the connection status of the socket > GetMessage() returns information from the TStringList > Disconnect() signals the worker thread to gracefully drop the > connection (if > possible) and close down Just call the right TWSocket methods > One of the difficulties seems to be that the socket would be running > within > the worker thread but the functions and data that I need to access > would be > in the global scope. If you are certain you need a separate thread then you can use PostMessage (or SendMessage) -- mvg, Wilfried http://www.mestdagh.biz http://www.comfortsoftware.be http://www.expertsoftware.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be