Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
Matt, I'd appreciate it if you could send me the C++ code for the DLL and the utility that will terminate all non-essential programs. The reason I ask for both is that I would like to try my hand at some JNI, but in case I seem to be really stuck I can then call your utility. Also, just out of curiosity, how do you get the computer to restart. I know a way (using BASIC) to bring up the dialog box that gives the choices of shutting down, restarting, etc. (the same box that comes up if you go to As an added note: Does anyone know how BufferedReader.read() works exactly? Cause I'm reading from a file (using BufferedReader and FileReader) which is formatted as such: the first line contains a number, the second line some text, the third line some more text and repeat. When I'm reading the file, I use the read() and readLine() methods to read each section (composed of three lines). But for some reason, the read() method seems to skip the first line (containin the int) and reads the first character of the second line and returns a number associated with it (it doesn't seem to be the ASCII equivalent, so it might be the Unicode equivalent). Anyway, here's my simplified code:
If the contents of test1.txt were:
then, the output would be
but, if the contents were:
then, the output would be
whereas if the contents were:
then the output would be:
> These are things that you cannot really do with Java (you can kind of do it using JNI, but you'll still have to write non-Java code). I have done all them except the auto-logon with C++/Windows API. > If you want, I can send you some utility programs I've written that will reboot windows and that will terminate all "non-essential" processes. You could run these with Runtime.exec(), which is a lot less work than all the JNI stuff and amounts to the same thing, essentially. If you want to do the JNI for practice and experience (it isn't too tough), I can give you some C++ source code to use on the DLL side. > The trick to running a program exclusively on startup is to put it in the RunOnce key in the registry (not the Run); this is because the programs in RunOnce are executed serially, whereas those in Run are all forked "in parallel." > As far as the auto-login, I haven't done that before, but I suspect, it may be possible to set things up so that it boots with no login into a mode where it does your defrag, then reboots again and presents you with your normal login. That is, while doing the defrag, it is not logged on as you, but as some user (eg. "D. Frag") who has no login password. > By the way, is this Windows 9x/Me, NT, 2k, or XP, or... Depending upon the OS, the login trick may be more or less difficult. > - mfg > Replies:
|
Sponsored Links
|