Interesting application. Pausable, resumable asynchronous downloader. If I
had the time, I'd write one. If you get yours working, I'll be at the front
of the line to buy a copy. But here's what I think:
1. Resorting to using the API should be a last chance. Understand that
the purpose of the CLR and the .NET platform is to be platform (and to a
degree) language independant. Writing a line of code that invokes an API
function MARRIES your application to that version of that specific DLL.
Please use the tools in the .NET Class Library.
2. You mention that you want your application to either pause or slow
down when someone accesses the console. For this, perhaps it is enough for
your application to simply change its priority level.
3. You seem to want this thing to be able to run for a long time, as
needed. I bet you even want to be able to queue up items in a list to
download in the background. For an application like this, I recommend that
you consider writing it as a Windows Service.
4. You ask about pausing your downloader. Off the top of my head, that's
a tough one. The implementation of that is tricky, because you can "pause"
while reading a stream, but what you really want to do is close your stream
and be able to continue reading it later. I cannot answer that because I'm
just a transactional database clown.
Of course, now that I've gone and complained about calling API functions,
the SetPriorityClass function will let you set your application as low,
medium or high priority as users log on or off. Where it gets "fun" is when
you have to dig out your own process handle to pass to the thing.
One more word about pausing / resuming: it may or may not be desirable,
depending on your implementation, but it is possible to
System.Threading.Thread.Suspend(Me) or something like that.
Dang. Now you went and made me want to write the thing myself, just for
fun. OO! and in multiple protocols! (Think Sockets)
--
Peace & happy computing,
Mike Labosh, MCSD MCT
"Escriba coda ergo sum." -- vbSensei
"mini chifa" <fr**************@yahoo.com> wrote in message
news:11********************@g49g2000cwa.googlegrou ps.com...
Hi, I've been programming VB.net for almost 2 years now. I wanted to
make a program that would automatically control a download program
(when other computers log onto the network, download program stops.
when no one is logged on, download program starts).
I've written the detection part, but I'm having trouble writing the
part for pausing the downloader. someone suggested using API. I've
tried to find information about API, but nothing seems to be connected.
Some sites say that it is for automation, while others say that it is
for making application programming easier. So far all that i've been
able to do is get the handle using FindWindow.
The downloader is in the system tray, all I need to do is right click
and 'pause', right click and 'resume'.
1) Is API the right thing to do this with?
2) How would I go about doing this?
3) Is there a list of API calls/functions that I could see? I've looked
at the msdn library, but I had no idea what I was looking for.
thanks for ANY help!
-matt