Results 1 to 8 of 8

Thread: Event log, System tray and batch job

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Stockholm, Sweden
    Posts
    83
    I have developed a VB program that access a database via ODBC and creates an Excel file as the result.

    This program should run on an NT Server once a day started by the Scheduler.

    How should the program comunicate to the outside how it works. Write in the Event log ? Should it be a services and pop up in the system tray ? Or both ?

    If I sometime want to pass a parameter to the program how should I do that if it is a services ?

    All suggestions needed , hopefully with program examples.
    Yesterday, all my troubles seemed so far away...
    Help, I need somebody, Help...
    Now MCSD and still locking for intresting job in the south parts of Stockholm, Sweden.

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Well if it's started bu the Scheduler it shouldn't be a service. Becuase that would mean that the Scheduler should start and stop that service once every day.

    And since it runs on a server it shouldn't have a ny GUI at all. Writing to the NT event log sounds like a good idea. You can use the App.LogEvent method to do so.

    If you want to pass arguments to the app you could simply design it to look for a text file in a predefined folder on startup. If the file exists it reads the file and uses the information as it would have been arguments passed to the application.
    The app should then remove the file.

    Best regards

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Stockholm, Sweden
    Posts
    83
    Thanks Joacim, I will use the App.LogEvent as a start.

    It don't have to use the Scheduler but that seemd the easy solotuion but maybe a services would be better, I don't know.

    Have anyone used services ?
    Yesterday, all my troubles seemed so far away...
    Help, I need somebody, Help...
    Now MCSD and still locking for intresting job in the south parts of Stockholm, Sweden.

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Yes I have a couple of times. Making a NT service using VB is somewhat compicated. Unless you download the NT Service Toolkit component from Desaware.
    In your case however I think that making a NT Service is bit of a overkill because your app is only suppose to run once every day and not all the time.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Stockholm, Sweden
    Posts
    83

    Event Viewer

    Have do I change the source in the Event Viewer from VBRuntime to my program name ?
    Yesterday, all my troubles seemed so far away...
    Help, I need somebody, Help...
    Now MCSD and still locking for intresting job in the south parts of Stockholm, Sweden.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Stockholm, Sweden
    Posts
    83
    I dont get the LogEvent to log then I am in the IDE but the exe does it. Should it be like that ?
    Yesterday, all my troubles seemed so far away...
    Help, I need somebody, Help...
    Now MCSD and still locking for intresting job in the south parts of Stockholm, Sweden.

  7. #7
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Yupp! You can only logg the event when your app is compiled.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Stockholm, Sweden
    Posts
    83
    Thanks Jocaim !

    I got some help from another source so I now use

    Private Declare Function ReportEvent Lib "advapi32.dll" Alias "ReportEventA" (ByVal hEventLog As Long, ByVal wType As Integer, ByVal wCategory As Integer, ByVal dwEventID As Long, ByVal lpUserSid As Any, ByVal wNumStrings As Integer, ByVal dwDataSize As Long, plpStrings As Long, lpRawData As Any) As Boolean

    That make it possible to write events in the IDE and to set the source.
    But I have not figured out how to use the dwEventID parameter or how to remove "The description for Event ID ( 1 ) in Source ( CosXFile_01 ) could not be found." text in the Event Viewer Detail.
    Yesterday, all my troubles seemed so far away...
    Help, I need somebody, Help...
    Now MCSD and still locking for intresting job in the south parts of Stockholm, Sweden.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width