Click here to Skip to main content
15,851,902 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
How can i make a program that is constantly reading a folder to see if there is a *.txt file there, and if there is it will read it and send the info there in keystrokes to another window, they it erases the file and restarts the process of trying to read...


1 solution

Well, you have major issues with this task.

1 - what if your other task tries to read the file when it's being written ? How often will it be written ?
2 - how do you make sure nothing is written to the file between you reading it and you deleting it ?

Ignoring these issues, and the incredible hack that is sending keystrokes to another window that's not in your app ( but you can do it by sending the window WM messages ), you just set up a file watcher in a service that watches that location. It doesn't have to be a service, but it sounds like you'd want it to be.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900