I want to know that how to keep my application running constantly at background?? And how to trigger it on specific action? Is there any other way except using timer? And is it possible by using Timer?
please help me.
Anita
Printable View
I want to know that how to keep my application running constantly at background?? And how to trigger it on specific action? Is there any other way except using timer? And is it possible by using Timer?
please help me.
Anita
These guys have a time and hotkey DLL:
http://www.merrioncomputing.com/Download/index.htm
I'm not exactly sure what you're trying to do, but this should give
you a start.
HTH
I have an application that runs in the background as soon as the PC boots, and polls a server for the presence of a specific text file every 30 minutes. If it finds it performs a task, if it doesn't, it waits for another 30 minutes and checks again, so the answer to your question is: Sure...
My application is installed in C:\WINDOWS\All Users\Start Menu\Programs\StartUp, so it starts when the PC boots. There is only one form, and it is hidden.
I'm not sure where else to go with this in so far as I don't know what the specifics of your application needs are, but, I hope this helps. :D
I think you can run your application as a service, that way it is in the background, then you may be able to activate it by another program, it is just a thought
Hack,
Can u give me u'r code..well i just want how to keep my aplication running. U said that in u'r application u r checking the status after some every 20 minutes..I want to do the exactly same thing. But i want to check whether the PC is connected to internet after every 30 seconds..How can i do that..please help me..
Anita.
Can anyone help me???
You'll certainly have to use timer control for that purpose... Create A Standard Exe, put it in StartUp and use the timer event to check the internet connection...What's the problem in it??
hello, can anybody tell me how to use timer control to run application on the background constantly? I'm not getting it..
Please
Anita
can anybody?
well if you put a timer control on a form.. and set its interval to 60000 (i think that is as high as it goes, which should be a minute)
Have an integer variable in your app...
on the tmrMyTimer_Timer() event check the value of your variable... if it is >= 30 then run the check and set the variable back to 0 otherwise incriment the variable by 1.
kinda like
Code:Private Sub MyTmr_Timer()
if MyVar >= 30 then
CheckNetConnection
MyVar = 0
else
MyVar = MyVar + 1
end if
end sub
There is another way
Just go to this page and there is a application called firedaemon. This will allow you to make any application to run as service. You can run it with parameters so that should make your life easier.
Just call it from a shell with some parameters and that should do the trick
that might do the trick.. but does not run on 95,98,Me platforms..Quote:
Originally posted by Mystical
There is another way
Just go to this page and there is a application called firedaemon. This will allow you to make any application to run as service. You can run it with parameters so that should make your life easier.
Just call it from a shell with some parameters and that should do the trick
Anita...Timer is not used to "Run Programs in Background constantly" :) actually you'll have to make you exe a service... two years back I did it with some code...and this code is at my home pc... well... i believe i'll be able to post it...as soon as i get home...
Is it correct that i can't use Timer to run my application constantly at background? Can anybody help me? Please...How to keep my application running constantly on background? I'm confused...Quote:
Originally posted by moinkhan
Anita...Timer is not used to "Run Programs in Background constantly" :) actually you'll have to make you exe a service... two years back I did it with some code...and this code is at my home pc... well... i believe i'll be able to post it...as soon as i get home...
Thanks in Advance..
Anita..
Can anybody help me??Quote:
Originally posted by anita2002
Is it correct that i can't use Timer to run my application constantly at background? Can anybody help me? Please...How to keep my application running constantly on background? I'm confused...
Thanks in Advance..
Anita..
Please....
Can anybody help me?? Does anyone have some code related to this?Quote:
Originally posted by anita2002
Is it correct that i can't use Timer to run my application constantly at background? Can anybody help me? Please...How to keep my application running constantly on background? I'm confused...
Thanks in Advance..
Anita..
Please....
Anita
What do you mean by running the program in background constantly? What i understand you want your program to be loaded with the windows and run silently in the background to check something (Internet connection) or to wait something(Dewali maybe:))
To run the program in the background just put its exe name in Registry... I think you've asked the question on the forum. and to check for the special event... for your convenience place a timer in the exe which will check for the special event..
So the timer is not literally used for <B>Running in Background</B> it just performs a check (in your situation).
Here you go Anita...
This is the code to make your exe a service...
put this code in module
Private Declare Function GetCurrentProcessId Lib "Kernel32" () As Long
Private Declare Function RegisterServiceProcess Lib "Kernel32" (ByVal dwProcessID As Long, ByVal dwType As Long) As Long
Private Const RSP_UNREGISTER_SERVICE = 0
Private Const RSP_SIMPLE_SERVICE = 1
Public Sub MakeMeService() 'Call this function in Form_Load
Dim pID As Long
Dim regserv As Long
pID = GetCurrentProcessId
regserv = RegisterServiceProcess(pID, RSP_SIMPLE_SERVICE)
End Sub
Public Sub UnMakeMeService() 'And this on Form_Unload
Dim pID As Long
Dim regserv As Long
pID = GetCurrentProcessId
regserv = RegisterServiceProcess(pID, RSP_UNREGISTER_SERVICE) 'Clean Sweep
End Sub
Thanks Moin Kahan,
but when i put u'r code in module and call the specified function for from form_load then it is giving me error....
Can't find DLL entry point RegisterServiceProcess in Kernel32"..
what can i do now??
please help me..
Anita
Don't tell me that you are using NT!!!!!!!!!
try this
And this on the form_loadCode:'Put this in a module
Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal Hkey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal Hkey As Long) As Long
Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal Hkey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Public Const REG_SZ = 1 ' Unicode nul terminated String
Public Const REG_DWORD = 4 ' 32-bit number
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Sub savestring(Hkey As Long, strPath As String, strValue As String, strData As String)
Dim keyhand As Long
Dim r As Long
r = RegCreateKey(Hkey, strPath, keyhand)
r = RegSetValueEx(keyhand, strValue, 0, REG_SZ, ByVal strData, Len(strData))
r = RegCloseKey(keyhand)
End Sub
the above code will also get the path of the file and put it on the reg on its own..Code:Dim sPath As String
sPath = App.Path
If Right$(sPath, 1) <> "\" Then
sPath = sPath & "\"
End If
sPath = sPath & App.EXEName & ".exe"
Call savestring(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\Currentversion\Run", "keyname", sPath)