I have a console app that when started check for internet connection availability and than download someting from the web and close it self. But I need to implement two new features to it and don't know how. It should stay in memory even if conn is not available and check for it periodicaly and than download the file. And the socond one is to implement download resume function. I would send my 3 KB app to anyone who is able to append these features to it and send it back to me. with a bit of comment. Thank you very much. i am absolute beginner in MASM. Thank you. Radim.
Posted on 2001-02-04 15:29:00 by raguru
Okay, staying in memory is a relatively easy task. Just make a subroutine to check internet or intranet connectivity, then make a timer using Windows. However many milliseconds is up to you. However, there is one trick...you have to also write a timer catching routine, since a console based program doesn't necessarily recieve messages. Once that's done, you can call the internet connectivity subroutine from the timer routine, which takes care of your first requirement. Your second one is a bit more complex, but if you take a look at the HTTP download program from Iczelion's site, it should cover that in pretty good detail. If that's confusing, here's what I mean: ; program psuedocode ; program initialization call InternetConnectivity .if eax==1 call Download .endif call SetTimer mov eax,1 .while eax==1 call ProgramTerminated .endw ; exit program InternetConnectivity proc ; attempt to connect to server ; if failed, return 0 ; else return 1 InternetConnectivity endp Download proc ; download the program or whatever it is Download endp ; SetTimer ; Use SetTimer to set a specific time out value ; and create a procedure (like the one below) ; to be called when it times out. Check the ; Win32API for more TimerExpired proc a:DWORD,b:DWORD,c:DWORD,d:DWORD call InternetConnectivity .if eax==1 call Download .endif ret TimerExpired endp ProgramTerminated proc ; check to see if the user wants to exit by checking ; various key and mouse button combinations. ; if so, return 0 ; otherwise return 1 ProgramTerminated endp
Posted on 2001-02-05 01:03:00 by Racso