|
-
Jan 2nd, 2007, 05:35 AM
#1
Thread Starter
Member
[RESOLVED] Shutdown computer after downloads
I'm using Visual basic 6 and I want to make a program that shuts down the computer automatically after I finish downloading so I can download overnight if I need to. I know how to shutdown the computer with VB, and I got a program the shuts the computer down after a certain time. What I want is to shut the computer down immediately after my internet is inactive for 10 seconds.
My problem is, I need my program to receive all the incoming data from downloading or detect the internet traffic so that my program knows when the computer's internet is inactive. The only way I can think of is Winsock, but it cannot receive all the incoming data or detect the internet traffic.
Last edited by evan29; Jan 2nd, 2007 at 06:24 AM.
-
Jan 2nd, 2007, 08:38 AM
#2
New Member
Re: Shutdown computer after downloads
Interesting topic....
Could you please advise from where are you downloading the data?
is it an FTP site ? a P2P site? Web Server ?
It is not so important , but it can give a starting point...
-
Jan 2nd, 2007, 11:57 AM
#3
Re: Shutdown computer after downloads
You could monitor packets being received to the computer.
Here is a raw packet sniffer made in just VB:
http://www.pscode.com/vb/scripts/Sho...46567&lngWId=1
I think it only detects packets being received, and not sent. But that should work, as it's rare to send data on the internet and not receive anything after...
Alternatively, you might be able to use code from a bandwidth monitor program. I've never looked at the code for one of these so I'm not sure exactly how they work.
http://www.pscode.com/vb/scripts/Bro...t=Alphabetical
-
Jan 3rd, 2007, 06:19 AM
#4
Thread Starter
Member
Re: Shutdown computer after downloads
Thanks DigiRev, I'll try it out. If you want I can upload the source code or the whole project when I'm done. This program will prove to be useful for me and can also be useful for everyone here that download a bunch of stuff.
EDIT: This code is sort of confusing me because there is so much code in it. I couldn't actually get it to work in my new project file. Can you help me put the code together?
This Code: http://www.pscode.com/vb/scripts/Sh...=46567&lngWId=1
I got confused so I just put all those modules and class modules into my project, and some of that code of the Main Form. I also got the references that were needed. No components seemed like they were needed.
This Code: http://www.pscode.com/vb/scripts/Br...rt=Alphabetical
I have no idea how this code works.
Make something like changing a text box whenever the computer receives that data. The content of data is not so important, its just the part where my program detects incoming data that is important - so that my program would be compatible with any downloading program, like your internet browser or your download manager or even P2P programs. Could there any API calls that would be possible to do this with? I'm not experienced with API calls but it may be easier, otherwise I'll stay away from API calling for this program.
Last edited by evan29; Jan 3rd, 2007 at 08:04 AM.
-
Jan 4th, 2007, 01:09 AM
#5
Fanatic Member
Re: Shutdown computer after downloads
Evan, I had thoughts about download and shut-down program. I was looking at the CPU load, or when an active job stopped being active or watching the packets.
With a lot of Vbforms help, I created? more like assembled and posted the Shut-Down code. I am currious to see your direction.
Alpha Micro: Alpha Basic, AS400 V5r2, EDI (Trusted Link/ Inovis.com),Access AS/400 via VB6, Qbasic for data conversions. A mix of Hardware too. ASCII Table , New Number to Words/66 digits , AS/400(v5r2) VB6 Viewer/Ask for code(ODBC) ^ What Is Transferring? , Check your Ports #Perfect Passwords , *Slide Bar Example , Logoff, Restart, Shut-Down PC *Keep Form On Top , Opaque Form ^ Create Objects at Run Time @ Check Key Caps Locks # GetTickCount(System Up Time) * Convert text to Excel & Collected Icons + Resize: Form/Text box ^ PC GateWay via Shell $ Drag & Drop Game ! PopUpMenu *Print File/no Open# Timer on Mult Forms ~ Splash & Mult Forms & Lots of Comments + Random/Timer/Guess * Dec >Hex >Oct >Bin % Get MAC (NIC) < saving to Registry > Wookiee Cookies \ BackUpDisk / World Conection SpeedTest $ Glossary Commonly Used Terms # phonetic list @ Detailed Computer Scan
When posting Code, Use tags.. [CODE] *Your Code* [/CODE]
-
Jan 4th, 2007, 03:52 AM
#6
Re: Shutdown computer after downloads
I was able to pull the class modules from one of those bandwidth monitor programs and use them to see if the internet is idle.
It does this by checking bytes sent/received and if they don't change for 10 seconds then it will shut down the computer.
There's code for shutting down the computer on these forums and on the internet if you search.
All you have to do is put the shut down code in the tmrWait() procedure where the comment says .
You can also change the SECONDS constant to however many seconds you want to wait before shutting down.
If you need any help let us know.
Last edited by DigiRev; Mar 26th, 2007 at 02:55 AM.
-
Jan 4th, 2007, 04:42 AM
#7
Thread Starter
Member
-
Jan 4th, 2007, 05:32 AM
#8
Re: [RESOLVED] Shutdown computer after downloads
Cool.
Glad you got it working.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|