actually, if you use the OCX I provide you, you will have to add this OCX and use it to code, the code will be much simpler than to use API, if you don't want to use it, you don't need to add any references, except that you will have to use the APIS, StartService, OpenSCManager, StopService, GetServiceDisplayName, OpenService, etc.. Each time you use a API, you need to add the API declarations and some time, a structure used with the API (that case, there is a SERVICE_STATUS structure you may need). There is no object provided with VisualBasic to create a service, the OCX I show you is the one Microsoft Distribute, but you can find other on the market (Desaware NT Service ToolKit), but they cost money.
Originally posted by JeffB actually, if you use the OCX I provide you, you will have to add this OCX and use it to code, the code will be much simpler than to use API, if you don't want to use it, you don't need to add any references, except that you will have to use the APIS, StartService, OpenSCManager, StopService, GetServiceDisplayName, OpenService, etc.. Each time you use a API, you need to add the API declarations and some time, a structure used with the API (that case, there is a SERVICE_STATUS structure you may need). There is no object provided with VisualBasic to create a service, the OCX I show you is the one Microsoft Distribute, but you can find other on the market (Desaware NT Service ToolKit), but they cost money.
Thanks a lot for the info,Actually i could not download that sample code you were talking about.I could now,Jeff I am not a VC++ guy,so tell me is that ocx created in vc++ so what should i do to add it in vb program
the OCX is created in Visual C++, but you don't need to do that, you only add the OCX in your project on your form, like the way you add and use a CommonDialog object. in the downlaod is include the compiled OCX, the source C++ code and a sample in VB (with code and properly working). To add a OCX, on your form, do Add Composants, browse and go search for the OCX, an icon will be added to your toolbar, select it and put it on your form, the default name will be NTService1, you will see all his property, and you can use Object Explorer to look property, const and method
Originally posted by JeffB the OCX is created in Visual C++, but you don't need to do that, you only add the OCX in your project on your form, like the way you add and use a CommonDialog object. in the downlaod is include the compiled OCX, the source C++ code and a sample in VB (with code and properly working). To add a OCX, on your form, do Add Composants, browse and go search for the OCX, an icon will be added to your toolbar, select it and put it on your form, the default name will be NTService1, you will see all his property, and you can use Object Explorer to look property, const and method
JeffB - hope it helps
Hi Jeff,
I am working on it,I will get back when i have some problem,hopefully i wont have any.I have to create my own service which queries database and sends a response when the condition matches.
If you have any suggestion ,do reply.
Originally posted by JeffB here is the sample plus OCX:
JeffB
hi jeff,
everything fine,but i am not able to see it in services.how to run it.
i think it is not entering this statement "If Command = "-install" Then"
do i have to set anything before i run my exe.
Yeah, before running a service, it must be installed on the computer, Configuration Pannel -> Service, and you need administrator right to install / uninstall it, you can look the service already installed on your computer with regedit:
You might also want your service to use an NT account and his password, because your service will be running even if no one is logged, so if you use ADO (for example), you absolutely need registry key, and when no user is connected, no registry, error and, because a service, you don't know when it is bugged (except if you use custom log or the NTService logevent that write to NT log)
Originally posted by DSJ The first time you run it you must pass -install as a commandline parameter to install it as a service. Your command line should look like
YouServiceName.exe -install
hi dsj,
my serive exe is called "sample.exe"
so i have to give 'sample.exe -install' in the command prompt isn't ?
or do i have to give the path where it recides.
I dont get exactly what you are saying,when i type that in my command prompt it gives an error saying "command not recognised"
could you be a little more specific.
Or is there anything else i have to do.
Originally posted by JeffB Yeah, before running a service, it must be installed on the computer, Configuration Pannel -> Service, and you need administrator right to install / uninstall it, you can look the service already installed on your computer with regedit:
You might also want your service to use an NT account and his password, because your service will be running even if no one is logged, so if you use ADO (for example), you absolutely need registry key, and when no user is connected, no registry, error and, because a service, you don't know when it is bugged (except if you use custom log or the NTService logevent that write to NT log)
JeffB
hi jeff,
hi dsj,
my serive exe is called "sample.exe"
so i have to give 'sample.exe -install' in the command prompt isn't ?
or do i have to give the path where it recides.
I dont get exactly how and what you are saying,when i type that in my command prompt it gives an error saying "command not recognised"
could you be a little more specific.
Or is there anything else i have to do.
>First, compile your EXE with Visual Basic (create the EXE, not execute the program), after, go to MSDOS, browse your HardDisk by using cd.. and cd /NameFolder (or type C: to go to the root of your C Next, when it come to your EXE, type sample -install, it will look like C:\AppName\> sample -install
>Second, go to StartMenu, go to Execute, on the little window, go to browse, select your EXE (sample.exe), add to the text that should be sample.exe " -install" so it will be writed in the textbox: "sample.exe -install"
>Directly from VB, when you compile your code and execute it FROM VB, you can add command property, before running the app, go to -project/property of sample, then on the tab create, search for the textbox parameters of the command line (my version is in french, so the translate might be innaccurate ), then type -install
>Because Service are a little special, your project will need a documentation, for any one that must install it on his computer, they must know to type -install, to have administrator rights and to type -uninstall (or whatever you want the parameters to be, I was using -i and -u)
Originally posted by JeffB There's three way to do it:
>First, compile your EXE with Visual Basic (create the EXE, not execute the program), after, go to MSDOS, browse your HardDisk by using cd.. and cd /NameFolder (or type C: to go to the root of your C Next, when it come to your EXE, type sample -install, it will look like C:\AppName\> sample -install
>Second, go to StartMenu, go to Execute, on the little window, go to browse, select your EXE (sample.exe), add to the text that should be sample.exe " -install" so it will be writed in the textbox: "sample.exe -install"
>Directly from VB, when you compile your code and execute it FROM VB, you can add command property, before running the app, go to -project/property of sample, then on the tab create, search for the textbox parameters of the command line (my version is in french, so the translate might be innaccurate ), then type -install
>Because Service are a little special, your project will need a documentation, for any one that must install it on his computer, they must know to type -install, to have administrator rights and to type -uninstall (or whatever you want the parameters to be, I was using -i and -u)
JeffB - hope it helps
Hey Jeff,
That was of great help.thanks a lot.Actually i have to query a database and perform certain actions...do you think i can do this ?
I will give it a try on monday.
Also if you have any idea about VB.NET:-My question is If i create a EXE in VB.NET and have to install in client systems,what are the minimum requirements for that client machine.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.