|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
API confusionmake 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 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) -- Show quoteHide quotePeace & happy computing, Mike Labosh, MCSD MCT "Escriba coda ergo sum." -- vbSensei "mini chifa" <frustratedmas***@yahoo.com> wrote in message news:1137901852.841837.6540@g49g2000cwa.googlegroups.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 > I'm not sure you understood me correctly...
I have a program that does the downloading, but it chews up all my bandwidth. What i'm looking to do is to create a program that will tell the downloader to pause (It has a pause option) when I or anyone on my network is using the internet. My downloader runs in the system tray, and all I have to do is right click and 'pause'. I thought that there might be a way to access the options via programming. If it's not possible to do that in the background, is it possible to control the mouse arrow. have it go to the coordinates, etc..? -matt > I'm not sure you understood me correctly... Yes, I misunderstood. hehe> > I have a program that does the downloading, but it chews up all my > bandwidth. What i'm looking to do is to create a program that will tell > the downloader to pause (It has a pause option) when I or anyone on my > network is using the internet. > > My downloader runs in the system tray, and all I have to do is right > click and 'pause'. I thought that there might be a way to access the > options via programming. To send a command to a system tray icon that belongs to another application, you WILL have to resort to the API. SHELL32.DLL used to have a function called SHNotifyIcon or ShellNotifyIcon or something like that, but I either can't think of how it's spelled, or I can't find it in the MSDN index. On the VB 5.0 Enterprise Edition CD, there was a "Unsupported" folder that had a code sample for making a system tray icon with the API, and this function that I can't remember is the way the application had to notify it of stuff. ...And now I can't even find that disk to go lookup the code sample. That's all I know, sorry. To do it the hard way, you could use FindWindow or GetWindow to find the hWnd and then try to PostMessage some mouse clicks to it, (kind of like using SendKeys) but that gets messy, and I'm not sure you could get the hWnd of a tray icon by passing FindWindow the title text of its window -- because it's an icon, and doesn't have one. -- Peace & happy computing, Mike Labosh, MCSD MCT "Escriba coda ergo sum." -- vbSensei <OffTopic>
I left you a message at .Cafe, .Tavern, and your email account. Get in touch. cya, --AC </OffTopic> "Mike Labosh" <mlabosh_at_hotmail.com> wrote in message <snip/>news:%23Pz4$PcIGHA.376@TK2MSFTNGP12.phx.gbl... >> I'm not sure you understood me correctly... >> Show quoteHide quote > Peace & happy computing, > > Mike Labosh, MCSD MCT
Is F1 in VS2005 really dumb?
Time zones: Pretending to be somewhere else beginner question about classes "Global" Class Library: Best Practices? Threading question.... Newbe question, What am I doing wrong vb.net tabpage hiding painting Seeking VB.Net Proxy examples Detect if user is logged in ADO.NET now or LINQ later |
|||||||||||||||||||||||