|
-
Sep 15th, 2003, 03:13 PM
#1
Thread Starter
Frenzied Member
Application.StartupPath for Service
Is there an equivelent to Application.StartupPath for a Windows Service?
The Application object doesn't seem to be available for a service, and I'd like my user-defined parameters (stored in xml) to be stored in the application's directory. By default, the "start-in" directory for a service seems to be (on my machine) c:\winnt\system32.
TIA,
Mike
-
Sep 15th, 2003, 03:33 PM
#2
Sleep mode
VB Code:
System.Windows.Forms.MessageBox.Show(System.Windows.Forms.Application.StartupPath)
or use this at the top of your code
VB Code:
Imports System.Windows.Forms
-
Sep 15th, 2003, 07:00 PM
#3
Thread Starter
Frenzied Member
Shoot. Thought that was the answer, thanks Pirate, but not so.
System.Windows... is not available. That is, IntelliSense doesn't show it in the list after System, if you type it in, you get that blue underline and the tool tip is "Namespace or type 'Forms' for the Imports 'System.Windows.Forms' cannot be found."
It's not a typo, either. When I go to a regular Windows form-type application, I can Import it.
I started this project using the built-in stuff, choosing a Windows service.
There must be something somewhere that is not letting a generated service-type app access the stuff a form-type app can.
Either that or I'm missing something really basic.
-
Sep 15th, 2003, 07:06 PM
#4
Sleep mode
Can you check if your proj is referecing System.Windows.Forms.dll in the References item in Solution Explorer? though , this would be included by default but just to check it exists .
-
Sep 15th, 2003, 07:11 PM
#5
Thread Starter
Frenzied Member
Cool, thanks. That was it. I guess by default, a service does not automatically reference System.Windows.Forms.dll. Add the reference, and all is well.
Thanks again,
Mike
-
Sep 15th, 2003, 07:17 PM
#6
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|