Results 1 to 2 of 2
  1. #1
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed

    [Tutorial]Create Windows Service in Express

    Creating A Windows Service In Vb.net

    What is a Windows Service?

    Quote Originally Posted by MSDN Definitions
    Microsoft Windows services, formerly known as NT services, enable you to create long-running executable applications that run in their own Windows sessions. These services can be automatically started when the computer boots, can be paused and restarted, and do not show any user interface. These features make services ideal for use on a server or whenever you need long-running functionality that does not interfere with other users who are working on the same computer. You can also run services in the security context of a specific user account that is different from the logged-on user or the default computer account.
    Note:Windows Services are not available on older machines running Windows 95,98 Or ME , Windows 2000, NT, XP, + all have the ability however (not that this should be an issue, Just letting you know that windows services
    will not be Multi OS, only NT 4.0 and --->)

    If you want your application to be a running process in the background, Windows Services is the best approach

    Creating a Windows Service in VB.NET

    Before Vb.net Performing this task was hard or limited to the C++ Guru's because it required System Level Processes and Procedures But with the ,net framework and VB.net this task is 1000 times easier and more achievable.


    Note: The .net Framework will help us install and control Windows Service.


    As always, Open Vb.net and follow along, It is the only way you will learn anything.

    At this point you will realize you do not have the Windows Services Template, Why is that? © Microsoft does not offer a Windows Service Template for Express/Standard Editions.

    Well, Thanks to a guy by the name of Luis , We can add a Microsoft Service Template to your list (file attached)

    Once you have added the template, Create a New Windows Service Project Call it whatever you like and Press Ok

    You will notice there are 3 errors, The error looking for sub main is a easy fix, double click on it, and pick the only sub in the listbox.

    The Second and Third Errors are fixed by changing this

    [php]
    Global.My.MySettings
    [/php]

    To this

    [php]
    My.Settings
    [/php]

    In both Instances

    Now with that resolved , You should have a working Service Project.

    Treat this as a Form, Right click on Service1.vb and View Designer, From there you can drag and drop your components as if it was a form.

    So, Let's create your first Windows Service

    __________________________

    First thing Your Service Will Need is a Timer , So goto your toolbox and Drag a Timer to your Windows Service Template.

    [IMG]https://i111.photobucke*****m/albums/n121/golmor/image1-3.jpg[/IMG]

    Now Goto The Properties of Timer1 and change the Interval to 10000 (10 Seconds)

    [IMG]https://i111.photobucke*****m/albums/n121/golmor/image2.jpg[/IMG]

    Source Code For Timer 1

    (Double Click Timer1)(Timer_Tick Event)
    ' This will be executed every 20 seconds

    [php]
    'Create a New Instance for a Log
    Dim ML As New EventLog()

    'Check if a Event Log Exists
    If Not ML.SourceExists("Whatever You Called Your Application") Then
    ' Create a Log
    ML.CreateEventSource("Your Application", "Myservice Log")
    End If

    ML.Source = "What you called your application (Service)"

    ' Write a Log
    ML.WriteEntry("Service Log", "Log On For " & _
    CStr(TimeOfDay), EventLogEntryType******rmation)

    [/php]

    In this part of the code

    [php]
    Protected Overrides Sub OnStart(ByVal args() As String)

    End Sub
    [/php]

    Enable the timer

    [php]
    Timer1.Enabled = True
    [/php]

    And on service stop

    [php]
    Protected Overrides Sub OnStop()
    ' Add code here to perform any tear-down necessary to stop your service.
    End Sub
    [/php]

    Disable the timer

    [php]
    Timer1.enabled = false
    [/php]


    Now create your application/Service to do whatever it is you would like it to, and your good to go

    Virus Scan


     


     


     



    The Most complete application MPGH will ever offer - 68%




  2. The Following 4 Users Say Thank You to NextGen1 For This Useful Post:

    Blubb1337 (03-06-2010),edhunter (06-23-2015),MJLover (03-07-2010),___x][GooD. (01-19-2011)

  3. #2
    Zoom's Avatar
    Join Date
    May 2009
    Gender
    male
    Location
    Your going on my 24/7 DDoS hit list.
    Posts
    8,552
    Reputation
    127
    Thanks
    5,970
    My Mood
    Happy
    Doesn't seems to work on xp, as you said

    Good tutorial btw
    -Rest in peace leechers-

    Your PM box is 100% full.

Similar Threads

  1. [Tutorial]Creating D3D8 Base | Wallhack
    By Voltage552 in forum C++/C Programming
    Replies: 21
    Last Post: 05-16-2010, 08:05 PM
  2. [Tutorial] Create Matrial Wallhack
    By ~Mafioso~ in forum CounterStrike (CS) 1.6 Hacks / Counter Strike: Source (CSS) Hacks
    Replies: 5
    Last Post: 03-07-2010, 10:03 PM
  3. [Tutorial] Create Counter-Strike:Source Hacks
    By ~Mafioso~ in forum Visual Basic Programming
    Replies: 9
    Last Post: 01-31-2010, 05:42 PM
  4. [Help] need help with windows services stopping
    By XGelite in forum Visual Basic Programming
    Replies: 3
    Last Post: 10-23-2009, 01:54 PM
  5. [Tutorial] Make Window Always On top
    By blipi in forum Visual Basic Programming
    Replies: 3
    Last Post: 11-05-2007, 03:45 PM