[twsocket] Stopping the screen saver.
If my application is sitting waiting for some event, and the screen saver kicks in, is there a way to tell the screen saver to stop so that my application windows show up again? Thanks. John Dammeyer -- 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
[twsocket] [OT] Embedding ActiveX licenses in Delphi
My apologies for this off topic post but I'm not even sure where to ask this. I've got National Instruments ActiveX controls running in a test application. The Delphi Wrapper created when importing the control into my development environment appears to have also brought in the license string similar to the LICREQST.EXE app from Microsoft. In the wrapper it creates: TCWDSP = class(TOleControl) Private procedure InitControlData; override; procedure TCWDSP.InitControlData; const CLicenseKey: array[0..62] of Word = ( $006F, $006E, $0070, $006E, ... CControlData: TControlData2 = ( ClassID: '{4EE5F083-54CF-11D0-8B74-0020AF31CEF9}'; EventIID: ''; EventCount: 0; EventDispIDs: nil; LicenseKey: @CLicenseKey; Flags: $; Version: 401); begin ControlData := @CControlData; end; On the target system I run regsvr32 with the file.ocx to register it. But when I run the application the unlicensed control is displayed. National Instruments which doesn't support Delphi doesn't know how to help me. Their C solutiuon is: 3.Add the following code below AxMyProject.AxMyLicensedControl myControl = new AxMyProject.AxMyLicensedControl(); System.Reflection.FieldInfo f = typeof(AxHost).GetField(licenseKey, System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); f.SetValue(myControl, gnvlslnjskvlmlgnnimh); Which is probably what the wrapper is doing. But I can't see where the InitControlData is being invoked or how I make it understand that the control is licensed. Any ideas? Thanks John Dammeyer -- 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
Re: [twsocket] [OT] Hotfix rollup for all BDS 2006 versions andallTurbos
Hi Angus, The Borland US Online Shop has Turbo Delphi (for win32) Pro $399. They also sell the Professional Upgrade (I think for Delphi 7 and up) for $460 or New user for $1090. I heard that the free version couldn't take Active X controls but what about the one for $399? Thanks, John Turbo Delphi Explorer is really Delphi 10 Personal and is free, except it can be used for commercial development but in theory does not support any third party components, unless you patch the code. There's a rumour the hot fixes might fix some of methods people have found to install components in the Explorer version. Angus -- 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
[twsocket] When does OnSessionAvailable event fire
Hi, I've finally been able to restart a project from last October. Something has gone missing and code that used to work doesn't anymore. So I have to sort of start over. I've followed the example code, looked at my postings from back then in the archives but I'm having problems with the following sequence. On FormShow I execute the following code: if FirstTime then begin SrvSocket.Proto := 'udp'; SrvSocket.Addr:= '127.0.0.1';// Use loopback SrvSocket.Port:= PortEdit.Text;// Wait on this port (4000). SrvSocket.Listen; // Start listening for client which also fires // OnSessionConnected. FirstTime := FALSE; PortEdit.Enabled := FALSE; end; As per the example in the FAQ I want to run this method when 'OnSessionAvailable' fires but it never happens. What's needed to make this event fire? Running a client on that port (4000) doesn't seem to do anything while sending UDP messages to that port from a client app does get through. I think I'm missing something critical but can't quite figure it out. Thanks John Dammeyer procedure TForm1.SrvSocketSessionAvailable(Sender: TObject; ErrCode: Word); var NewHSocket : TSocket; PeerName : TSockAddrIn; Peer : String; begin PortEdit.Enabled := TRUE; { We need to accept the client connection } NewHSocket := SrvSocket.Accept; { And then associate this connection with our client socket } CliSocket.Dup(NewHSocket); { Wants to know who is connected to display on screen } CliSocket.GetPeerName(PeerName, Sizeof(PeerName)); { User likes to see internet address in dot notation } Peer := IntToStr(ord(PeerName.sin_addr.S_un_b.s_b1)) + '.' + IntToStr(ord(PeerName.sin_addr.S_un_b.s_b2)) + '.' + IntToStr(ord(PeerName.sin_addr.S_un_b.s_b3)) + '.' + IntToStr(ord(PeerName.sin_addr.S_un_b.s_b4)); InfoLabel.Caption := 'Remote ' + Peer + ' connected. Port:' + CliSocket.GetPeerPort; { Send a welcome message to the client } //CliSocket.SendStr('Hello' + #13 + #10); { Enable the server user to disconect the client } DisconnectButton.Enabled := TRUE; InitDisplayButton.Enabled := TRUE; end; -- 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
Re: [twsocket] When does OnSessionAvailable event fire
Ah. I see. Thank you. Before I posted my question I read as much information on all this as I could including my old postings from last year and the wsocket.hlp file. As I understand it then, the Wsocket.hlp file is wrong or even worse, vague giving the impression that something is possible when it really isn't. QUOTE from wsocket.hlp Applies to TWSocket Declaration Function Listen: Integer; Description The listen method is used to build a server application where a given socket must wait for incomming remote connections. The listen method ask the underlaying level to wait for connection. It is non blocking: listen returns immediately whitout waiting for an actual connection. When a connection will be available at a later time when the client connected, the OnSessionAvailable event will be generated. The OnSessionAvailable event handler will normally call the accept method to retreive the client connection handle. Before calling the listen method, you must properly setup the Addr, Port and Proto properties. END QUOTE The example that follows in the .hlp file uses telnet not tcp or udp. Perhaps an extra statement in the wsocket.hlp file that this does _not_ apply to UDP and that listen does not ever generate a call to OnSessionAvailable would have saved me some time. Cheers, John Dammeyer Wireless CAN with the CANRF module now available. http://www.autoartisans.com/products Automation Artisans Inc. Ph. 1 250 544 4950 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Francois PIETTE Sent: Saturday, June 10, 2006 11:20 AM To: ICS support mailing Subject: Re: [twsocket] When does OnSessionAvailable event fire I think I'm missing something critical but can't quite figure it out. Your are missing the fact that you use UDP and not TCP. UDP is connectionless and sessionless. So don't use TWSocketServer. Use TWSocket, make it listen and the just handle OnDataAvailable event to call Receive to get the incomming datagrams. Have a look at the document TCP/UDP primer available from support page at my website. -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: John Dammeyer [EMAIL PROTECTED] To: 'ICS support mailing' twsocket@elists.org Sent: Saturday, June 10, 2006 8:04 PM Subject: [twsocket] When does OnSessionAvailable event fire Hi, I've finally been able to restart a project from last October. Something has gone missing and code that used to work doesn't anymore. So I have to sort of start over. I've followed the example code, looked at my postings from back then in the archives but I'm having problems with the following sequence. On FormShow I execute the following code: if FirstTime then begin SrvSocket.Proto := 'udp'; SrvSocket.Addr:= '127.0.0.1';// Use loopback SrvSocket.Port:= PortEdit.Text;// Wait on this port (4000). SrvSocket.Listen; // Start listening for client which also fires // OnSessionConnected. FirstTime := FALSE; PortEdit.Enabled := FALSE; end; As per the example in the FAQ I want to run this method when 'OnSessionAvailable' fires but it never happens. What's needed to make this event fire? Running a client on that port (4000) doesn't seem to do anything while sending UDP messages to that port from a client app does get through. I think I'm missing something critical but can't quite figure it out. Thanks John Dammeyer procedure TForm1.SrvSocketSessionAvailable(Sender: TObject; ErrCode: Word); var NewHSocket : TSocket; PeerName : TSockAddrIn; Peer : String; begin PortEdit.Enabled := TRUE; { We need to accept the client connection } NewHSocket := SrvSocket.Accept; { And then associate this connection with our client socket } CliSocket.Dup(NewHSocket); { Wants to know who is connected to display on screen } CliSocket.GetPeerName(PeerName, Sizeof(PeerName)); { User likes to see internet address in dot notation } Peer := IntToStr(ord(PeerName.sin_addr.S_un_b.s_b1)) + '.' + IntToStr(ord(PeerName.sin_addr.S_un_b.s_b2)) + '.' + IntToStr(ord(PeerName.sin_addr.S_un_b.s_b3)) + '.' + IntToStr(ord(PeerName.sin_addr.S_un_b.s_b4)); InfoLabel.Caption := 'Remote ' + Peer + ' connected. Port:' + CliSocket.GetPeerPort; { Send a welcome message to the client } //CliSocket.SendStr('Hello' + #13 + #10); { Enable the server user to disconect the client } DisconnectButton.Enabled := TRUE; InitDisplayButton.Enabled := TRUE; end; -- 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
Re: [twsocket] Error 10048 in TWSocket
Hi Francois, Probably am. Thing is, the server is ultimately going to be written in GCC running on Redhat 6.2 Linux. Since this appears to be a server issue perhaps it will go away then. But the fact that the two windows applications don't do the connection thing correctly tells me there is something wrong. The real question is still what? Thanks, John Dammeyer Why don't you use TWSocketServer ? Are you reinventing the wheel ? -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: John Dammeyer [EMAIL PROTECTED] To: 'ICS support mailing' twsocket@elists.org Sent: Wednesday, October 12, 2005 8:00 PM Subject: [twsocket] Error 10048 in TWSocket Hi all, I have a server and a client. The Server application is started and does the following: SrvSocket.Proto := 'tcp'; SrvSocket.Addr:= '0.0.0.0'; // Use any interface SrvSocket.Port:= '4000';// Wait on this port. SrvSocket.Listen; // Start listening for client I then start up the client which does this: CliSocket.Proto:= 'tcp'; CliSocket.Addr := HostnameEdit.Text; CliSocket.Port := '4000'; CliSocket.LocalPort := '4001'; CliSocket.Connect; So far so good. When the connection is established the server shows this: { We need to accept the client connection } NewHSocket := SrvSocket.Accept; { And then associate this connection with our client socket } CliSocket.Dup(NewHSocket); { Wants to know who is connected to display on screen } CliSocket.GetPeerName(PeerName, Sizeof(PeerName)); { User likes to see internet address in dot notation } Peer := IntToStr(ord(PeerName.sin_addr.S_un_b.s_b1)) + '.' + IntToStr(ord(PeerName.sin_addr.S_un_b.s_b2)) + '.' + IntToStr(ord(PeerName.sin_addr.S_un_b.s_b3)) + '.' + IntToStr(ord(PeerName.sin_addr.S_un_b.s_b4)); InfoLabel.Caption := 'Remote ' + Peer + ' connected. Port:' + CliSocket.GetPeerPort; And then the Server can send information to the client. m.Attrib := REVERSE_TEXT; m.Cmd := ATTRTEXT_CMD; CliSocket.Send(@m,sizeof(m)); The problem come with disconnecting and reconnecting. If I disconnect the server first by: { Server Application: Shutdown Server } CliSocket.ShutDown(SD_BOTH); { Shut the communication down } CliSocket.Close; { Close the communication } SrvSocket.ShutDown(SD_BOTH); { Shut the communication down } SrvSocket.Close; { Close the communication } And then shut down the client: { Client Application: Shut down client } CliSocket.ShutDown(SD_BOTH); { Shut the communication down } CliSocket.Close; I can easily reconnect without problems. However if I run the Client shutdown code first (or terminate the client application and restart) and shutdown the server code last, I get the Error 10048 which is 'Port in use'. That implies (since the client application is terminated and restarted), that the server application seems to be hanging onto the port. How do I code it so either side can 'crash', be rebooted or just disconnect and reconnect? Thanks, John Dammeyer -- 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
[twsocket] Missing F10 Key in EmulVT
Hi all, I've been working with EmulVT and Twsocket to create a net based clone of a standard windows CGA screen set up in C40 mode as interfaced to by Borland. I've been able to modify and add the appropriate methods in EmulVT.pas to create windows that are subsets of the 40x25 screen and have their home position referred to as 1,1 etc. I also now have blinking text using a timer in the mainline application to access screen.Lines[nRow] and blink characters. Pretty cool all in all. The original DOS application now instead of directly calling Borland routines, on request, sends messages out a TWSocket and the Client, (my screen and keyboard) initializes and shows a menu just like the original DOS app. I even went as far as to unprotect two of my ports on my firewall and have a friend across town run the client software while the server on my PC filled up his CRT. Too cool. Post card of Victoria BC will be on the way next week. Next I'm really just interested in returning keyboard entry as ASCII characters or the Delphi Virtual Key Codes. With that in mind I've modified the AppMessageHandler to call my own FOnKeyDown() function and for now print out a hex value of ASCII characters and 'F1' or 'F2' etc. for the function keys. Later I'll probably just return the VK_ values inside AppMessageHandler and remove all the multi-character string capabilities that exist for a VT100 terminal. Problem is, I'm missing F10. MS Windows appears to be doing something with it and waiting till a second character appears before giving up the next key. What's so special about F10? Thanks, John Dammeyer -- 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