Indy Telnet SendString robustness best practice - delphi

I have a simple Firemonkey application with a series of buttons and sliders (track bar) that when a user interacts with these controls it send a command using IdTelnet. i.e.
IdTelnet1.SendString(' '+str+#13);
The problem is that very occasionally the users experience total lockup of the app and windows reports the app as "Not responding" when clicking on something. I have not reproduced this myself however I suspect its related to clicking on buttons in quick succession.
My current theory is that I am getting re-entry into SendString and IdTelnet is not handling this well.
Before jumping into writing a queued sending system I wanted to ask for any best practice advice. Is this a known issue and what is the best way to do quick fire sends that are user initiated?

Related

Delphi Code for Cancelling or Continuing the lock attempt and Display an Alert When User Locks Computer

This is a toughie (I am obviously new to Stack Overflow)! Delphi code for displaying an alert (reminder) to sign out when a user locks their PC. I believe this would need:
Detect locking their Windows 7 or 10 computer / workstation.
Display a MessageDlg with 2 buttons: "Lock" (proceed with locking computer) and "Cancel Lock" (so that they can sign out online and then lock their computer).
This could possibly be an executable installed on their local computer that would run on StartUp in the background.
Please note, I have created simple Delphi programs in Delphi 6 for years but this is way above my "pay grade". If this is even possible MANY thanks for your time !! You cannot begin to imagine how helpful this would be!
Scott
I tried copying "How Do I detect a user locking / unlocking a screen in Windows 7". It did not have the lock cancelling feature that would allow a user to perform another task before locking their computer.
As far as I know it is not possible to prevent user from locking the computer. In fact it is quite common practice to have computers set up in a way so that they lock themselves automatically after certain time of user inactivity.
This can greatly improves overall IT security as in most cases prevents random person getting access to unlocked computer just because person that is otherwise using this computer stepped away for a few minutes.
Now if your program would somehow prevent this from happening you would be potentially compromising IT security.
In fact I suspect that you might want to actually increase IT security by forcing your users to regularly log out of the online system. But this is not the way to do it.
It would be much better if your online service would use time limited session management. What I mean by this? I mean that online service session should time-out after user hasn't performed any activity in this online service for certain time.

Delphi 7 TWebBrowser - how to exit it

I have developed a Delphi prog which logs into a website, collects "today's number" and displays it on a screen. Having got the data, the only place I could access it was in the final 'download completed' event. This doesn't seem right, as there seems to be no way to get away from the string of 'completed' events. The program never returns from the WB.Navigate call. WB.Stop and WB.Quit seem to refer to browser activity. I want a WB.TERMINATE or something! It's OK for now, but I want to put the web access in a loop, and with the current technique it just burrows deeper into the stack etc. I assume it's running in a separate thread, but can find no info about this. Should I put the browser component on a separate form created at run-time? Would freeing the form tidy things up? Any advice would be appreciated.
EDIT: Thanks for early responses. I must have had a senior moment. In fact the WB.Navigate call does return. The IDE tells me that it launched a thread with the web navigation request. So it's down to me to do some internal synchronizing to check the data arrival. Yes, the data is on the web page not a download. There is no API. I could have done basic searching of the web pages but it's 3 levels deep. The component made it easier to select the wanted data. All good now. Sorry for wasting your time.

Simulating Mouse Clicks within a minimized or inactive form

I'm having a hard time figuring out how to simulate mouse clicks and such in a window that is minimized or not currently active. In case it's not clear, I want my mouse to be able to click and stuff without actually using the mouse.
For example, while I'm browsing the web I would like my program to be able to be clicking inside of another application at the same time.
How can I accomplish this? All I can find is the same old movemouse and setcursorpos stuff... as we know that requires the use of your actual mouse/Cursor.
You are looking to automate applications. This is done not by faking input but by using an automation API. These days, the preferred one is UI Automation. This is perfectly accessible from Delphi: How to use MS UI Automation in Delphi 2009.

Delphi OLE Automation freezing GUI

We are using some OLE automation in Delphi 7 to open a word document, then once loaded, save it, and load it into a database.
This is working fine, but part of the requirement is to have a progress bar whilst the OLE bit is taking place, and also a timeout if the OLE part takes too long.
Problem we are having is that the entire GUI freezes whilst the OLE is taking place. The progress bar does nothing, then shoots up right at the end.
Any ideas on how we could approach this?
I think this is going to be difficult to do cleanly. So far as I know, Word automation doesn't give you the opportunity to cancel long running events. It also doesn't notify you of progress.
Probably the best that you can do is first of all move the automation into a separate thread. Then throw up a marquee progress bar whilst the long running automation is in progress. At least that will let the user know that something is happening.
As far as cancelling goes, you can let the user cancel from your progress dialog and then have your program continue. You could kill the automation thread, but that would leave Word in a bad state. I'd just let it continue to completion, but then ignore the results. From the user's perspective this will meet your goals reasonably well, even if it's a little dirty behind the scenes.

Instant Messaging With Priority For Developer Communication

My team communicates a lot with IM. We'll sometimes use IM to ask a question even to someone who's in the next cube over. The reason for this is that we all find that answering an IM is much less disrupting than talking.
Still, I find that the blinking message window can be disrupting when I'm heads down coding. I can't help but look at what people have written and it often keeps me from finishing my thought. This type of multitasking is a productivity killer. I've therefore turned off the alert feature (I'm using Pidgin). My Windows task bar is hidden so I need to drag my cursor to the bottom of the screen, let the task bar pop up, and look if the pidgin tray icon is flashing orange to find out about new messages.
This works well except that sometimes people have a quick question to ask for which they need a quick answer.
It would be great to have the ability to send priorities on messages:
Priority 3: Check this out when you can
Priority 2: Normal chat
Priority 1: Please reply quickly
The priority level would then be used to determine the alert method. E.g. (1)Give focus to window, (2)blink in task bar, (3)blink in tray.
Any ideas on an easy way of accomplishing this?
Thanks
We use e-mail or internal twitter for your Priority 3.
We use IM for Priority 2.
We use walking over to someone's desk for Priority 1.
Edit: I'm sorry I didn't realize you were asking an implementation question. If you didn't want to institute new policies/standards for methods of contact (ala introducing an internal twitter or the like), you would need to standardize everyone in the office on the same IM application/protocol. And then you'd need to modify one. Trying to add something into the jabber spec (if it doesn't have it, I don't know) would be tedious and not worth the effort.
If you really wanted to pursue that route, you would probably be better off moving to IRC and using scripts to alert you if people talk to you while preceding their message with a pound! or something similar.
I think that as soon as you introduce a "priority message" function, all messages will start to be high priority. Human nature. I just set my status to "busy" and don't reply to messages that come in when i'm "busy" unless it is important. People get the point quickly.
While I agree with the statement that being able to make certain messages a higher priority will result in ALL messages being high-priority, you can always just shut off the IM, and then people will have to actually talk to you. If they are on your team, they should know when you are heads-down, and take some personal responsibility in making the decision to disrupt you.
I do roughly the same thing that Codingscape does - I set my status to Away. Many clients will display an 'away text' message when your status changes, so I just use "I'm very busy" or a similar message.

Resources