Scriptdaemon 05-17-2007, 08:34 AM I Googled for help on this and only came across the built-in timer, but from what I found it only goes up to about 30 seconds (unless those sources were incorrect). Any help on accomplishing a task based on user input of hourly/daily/etc. (assuming the program will be run at all times.)
The program I have made is an automatic background randomizer, but I feel that's not really important information since I just need to know how to do something, say, once an hour or day or so on.
nikkiH 05-17-2007, 01:55 PM Perhaps a windows service is more what you're looking for?
A service runs in the background, and with vb.net, can basically have a Timer that does something every X minutes or whatever.
Scriptdaemon 05-17-2007, 03:15 PM Perhaps a windows service is more what you're looking for?
A service runs in the background, and with vb.net, can basically have a Timer that does something every X minutes or whatever.
Sounds probably what I need. How would I accomplish using this?
Brandoe85 05-17-2007, 03:37 PM Intro to window service, I believe it's in 2003 but there seems to be a link to 05 as well:
http://www.developerfusion.co.uk/show/3441/
Scriptdaemon 05-17-2007, 04:22 PM Intro to window service, I believe it's in 2003 but there seems to be a link to 05 as well:
http://www.developerfusion.co.uk/show/3441/
From that I have found some useful things regarding it, but it appears that I don't have the Windows Service template. It says only Standard Edition doesn't allow it (I have Express), so what's the deal?
Edit: With further investigation, I now understand that this version doesn't come with it either, however still lets you use the functionality.
oracleguy 05-17-2007, 05:22 PM You can store a date/time in the future when you want to change the background, then you can use the timer to check the current date and time against when it is supposed to change. When they match, you do your background changing thing.
Scriptdaemon 05-17-2007, 09:00 PM You can store a date/time in the future when you want to change the background, then you can use the timer to check the current date and time against when it is supposed to change. When they match, you do your background changing thing.
This isn't regarding a Windows Service is it? Because it's proving to be more difficult than I find necessary. (Plus I don't really want to have to install it, which seems to be mandatory if a Windows Service is used.)
Could you start me off just a bit on how to use a date/time in VB and how to use, say, a day ahead of time then have the timer compare itself to that time?
oracleguy 05-17-2007, 11:10 PM This isn't regarding a Windows Service is it? Because it's proving to be more difficult than I find necessary. (Plus I don't really want to have to install it, which seems to be mandatory if a Windows Service is used.)
Could you start me off just a bit on how to use a date/time in VB and how to use, say, a day ahead of time then have the timer compare itself to that time?
What I was talking about didn't require a service. As for code, maybe a little later today. It's been a few months since I've done any VB.NET.
Scriptdaemon 05-17-2007, 11:34 PM What I was talking about didn't require a service. As for code, maybe a little later today. It's been a few months since I've done any VB.NET.
Alright, thanks. I appreciate it. I'll do a little Googling about this as well.
Scriptdaemon 05-19-2007, 02:41 AM Alright, I found a way to do it where I would use:
Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Private Sub timerProc(ByVal hwnd As Long, ByVal lMsg As Long, ByVal lTimerID As Long, ByVal lTimer As Long)
changeDesktopBackground()
End Sub
But it says to use something like startTimer = SetTimer(0, 0, 300, AddressOf timerProc) to start it, but I always get an error saying "'AddressOf' expression cannot be converted to 'Long' because 'Long' is not a delegate type."
|
|