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

    Exclamation Problems with Excel Under Native C Service

    Hi ppl,

    The problem is weird to say the least. We have a Windows Service written under Native C and Com running on Windows Pro 64bit. The service shold spawn multiple threads (usually 2 or 3) that open Excel2007, register some addins, populate it with data and fires macros to do computation.

    Now the fun part, it looks like the Addins cannot be found, as the result of calculation (or lack of which) show. The weird part is that if I allow the service to interact with the desktop it runs just fine. We tried to set the service to run under Admin login instead of running it under SYSTEM (default login for all services) but the application fails on the first call to a macro ...

    We believe that the difference is in some permissions or settings for the Windows Service or the login used NOT the C code itself (the macros should be fine too, they been ran in stand alone too many times). If anyone could point me in the directions where to look for where to set it it would be awesome ...

  2. #2
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: Problems with Excel Under Native C Service

    The weird part is that if I allow the service to interact with the desktop it runs just fine
    That's because out of process COM (which you're using to communicate with Excel) only works when you have a message loop. Without one - it won't work.

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  3. #3
    Join Date
    Jul 2009
    Posts
    3

    Re: Problems with Excel Under Native C Service

    Quote Originally Posted by darwen View Post
    That's because out of process COM (which you're using to communicate with Excel) only works when you have a message loop. Without one - it won't work.
    well we installed the same service on another machine ... same specs as above and interaction with desktop is disabled ... it runs fine ...

  4. #4
    Join Date
    Jul 2009
    Posts
    3

    Talking Re: Problems with Excel Under Native C Service

    SOLVED IT!!!!

    The solution is even weirder then the problem ...
    the difference between the 2 machines (the 1 that has the problem and the one that doesn't) is that the service on one that works was run form a local user where the other one was run from a domain based user ... so as soon as i created a local user of the failing machine the calculations were made as they should ...
    apparently the too types of users have different settings ... i have no idea what is the difference but it works ...

Tags for this Thread

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