CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2002
    Posts
    55

    Starting COM object from Win Service...

    I can't seem to start a COM object using a windows service. I have added the proper reference. The code works in a Windows Application. This is an example of what I am trying to do:
    Code:
    Private Sub StartExcel()
       Dim XL1 As Excel.Application
       XL1 = CreateObject("Excel.Application")
    End Sub
    
    Protected Overrides Sub OnStart(ByVal args() As String)
       StartExcel()
    End Sub
    I am actually going to call the StartExcel sub using a timer checking the time of day. But I would like to get the CreateObject working first.
    Thanks
    Rel

  2. #2
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: Starting COM object from Win Service...

    You are trying to Interact with the Desktop that is the reason why it is not working. Set Allow Service to Interact With Desktop to True in the Services Control panel.

    Although I have never tried this before, but I am not sure if this will work.

  3. #3
    Join Date
    Dec 2002
    Posts
    55

    Re: Starting COM object from Win Service...

    Thanks for the reply. I have that box checked. Still nothing. No errors in the event viewer. I will have a look at permissions.

    Rel

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

Featured