473,395 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

API confusion

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

Jan 22 '06 #1
4 1201
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

Jan 22 '06 #2
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

Jan 23 '06 #3
> 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.


Yes, I misunderstood. hehe

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
Jan 25 '06 #4
AC
<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
news:%2***************@TK2MSFTNGP12.phx.gbl...
I'm not sure you understood me correctly...
<snip/> Peace & happy computing,

Mike Labosh, MCSD MCT

Jan 26 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Doug Farrell | last post by:
Hi all, I'm trying to do the following from within a code module: import re # text to match text = "Good morning x something /x, how are you today x something else /x"
1
by: Mathias Mamsch | last post by:
Hi, I have some confusion concerning the weakref module. I am trying to save a weak reference to a bound member function of a class instance for using it as a callback function. But I always...
38
by: Grant Edwards | last post by:
In an interview at http://acmqueue.com/modules.php?name=Content&pa=showpage&pid=273 Alan Kay said something I really liked, and I think it applies equally well to Python as well as the languages...
10
by: Kamilche | last post by:
I'm trying to pack two characters into a single byte, and the shifting in Python has me confused. Essentially, it should be possible to use a 'packed string' format in Python, where as long as...
4
by: JMCN | last post by:
object invalid or no longer set - confusion of the recordset in access 2003. i am currently converting from access 97 to access 2003. majority of the codes converted over perfectly fine, though...
0
by: i_have_control | last post by:
I'd be grateful for any input on this one: I have three web domains. The destinations of two are set to folders on the first, though that fact is transparent to the user (i.e: it does not...
13
by: Steve | last post by:
I have a form with a dataset and a datagrid. I created a dataview on this dataset. When the user modifies the datagrid, I look up this record in the dataview to make sure it is unique. Here is...
10
by: joelagnel | last post by:
hi friends, i've been having this confusion for about a year, i want to know the exact difference between text and binary files. using the fwrite function in c, i wrote 2 bytes of integers in...
1
by: Richard Lewis Haggard | last post by:
I'm having a problem with what appears to be some sort of confusion with references. I have a single solution with a dozen projects which has been working quite nicely for a while. The references...
2
by: Riaaaa | last post by:
Hello, We are doing the project in VB.Net. We had a great confusion for ASP.Net and VB.Net. Is VB.Net project performed in Microsoft Visual Studio 2005 ?? We have...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.