-
May 2nd, 2013, 03:14 AM
#76
Re: running a GUI program in the background
no i definately used Visual Studio Command Prompt
c:\Program Files\Microsoft Visual Studio 9.0\VC\run_process_from_service>make.bat
Last edited by beginner91; May 2nd, 2013 at 03:58 AM.
-
May 2nd, 2013, 06:15 AM
#77
Re: running a GUI program in the background
Originally Posted by beginner91
no i definately used Visual Studio Command Prompt
c:\Program Files\Microsoft Visual Studio 9.0\VC\run_process_from_service>make.bat
No you're definitely not. Visual Studio Command Prompt is a console process which environment is pre-set to use VS command line tools. Therefore it's impossible to not find windows.h in the one.
Best regards,
Igor
-
May 2nd, 2013, 06:21 AM
#78
Re: running a GUI program in the background
this is the only visual studio command prompt i found:
-
May 2nd, 2013, 01:07 PM
#79
Re: running a GUI program in the background
Given you have document entries for VS2010 and VS2012, perhaps your environment is screwed up? Did you install VS2010/VS2012 and then uninstall them? Have you looked at the system and/or user path settings - are there any entries that are stale? Is the path too long? To check, open a command prompt and type set.
-
May 2nd, 2013, 01:27 PM
#80
Re: running a GUI program in the background
Well, if you really run that, and compiler is not able to find windows.h, please take my condolences, as most probably your VS installation is broken. I used Visual Studio all versions since v4.0, and never had a problem like that. Never.
This is what my VSCP gives with my sample placed in C:\testService folder:
Windows 7, VS2010
Code:
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>cd \testService
C:\testService>make
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
test.cpp
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:test.exe
test.obj
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
10.cpp
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:10.exe
/out:mysvcx.exe
10.obj
C:\testService>
Same source code, Windows XP SP3, VS.NET2003
Code:
Setting environment for using Microsoft Visual Studio .NET 2003 tools.
(If you have another version of Visual Studio or Visual C++ installed and wish
to use its tools from the command line, run vcvars32.bat for that version.)
C:\Documents and Settings\Igor>cd \testService
C:\testService>make
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
test.cpp
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
/out:test.exe
test.obj
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
10.cpp
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
/out:10.exe
/out:mysvcx.exe
10.obj
LINK : warning LNK4089: all references to 'USER32.dll' discarded by /OPT:REF
C:\testService>
This is how it runs:
Code:
C:\testService>setup
C:\testService>if -u == goto UNINSTALL
C:\testService>sc create MyServiceX binPath= "C:\testService\mysvcx.exe"
[SC] CreateService SUCCESS
C:\testService>sc start MyServiceX
SERVICE_NAME: MyServiceX
TYPE : 10 WIN32_OWN_PROCESS
STATE : 2 START_PENDING
(NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x7d0
PID : 2656
FLAGS :
C:\testService>test.bat run
SERVICE_NAME: MyServiceX
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE,NOT_PAUSABLE,ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
C:\testService>test.bat stop
SERVICE_NAME: MyServiceX
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE,NOT_PAUSABLE,ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
C:\testService>setup -u
C:\testService>if -u == -u goto UNINSTALL
C:\testService>sc stop MyServiceX
SERVICE_NAME: MyServiceX
TYPE : 10 WIN32_OWN_PROCESS
STATE : 1 STOPPED
(NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
C:\testService>sc delete MyServiceX
[SC] DeleteService SUCCESS
C:\testService>
...and this is the log:
Code:
[05/02/13 22:19:11] ++ Start ++
[05/02/13 22:19:24] C:\testService\test.exe
[05/02/13 22:19:24] Waiting for test.exe stop...
[05/02/13 22:19:32] Detected test.exe stop.
[05/02/13 22:19:32] Quitting thread.
[05/02/13 22:19:39] -- Stop --
Of course you should remember about running your command prompt as administrator to be able to control your service states.
If you want to move any further from where you are, you should start with reproducing this behavior. Please note, the log file is the debugging tool itself, and so far it's very unlikely you need anything more sophisticated.
Last edited by Igor Vartanov; May 2nd, 2013 at 01:34 PM.
Best regards,
Igor
-
May 3rd, 2013, 03:04 AM
#81
Re: running a GUI program in the background
Did you install VS2010/VS2012 and then uninstall them?
yes i had the express version of VS2012 but i uninstalled it
so this is effecting my VS2008 now?
VS installation is broken
i don't know how it can be broken because other programs work fine
-
May 3rd, 2013, 11:45 AM
#82
Re: running a GUI program in the background
Originally Posted by beginner91
yes i had the express version of VS2012 but i uninstalled it
so this is effecting my VS2008 now?
Quite possibly.
Originally Posted by beginner91
i don't know how it can be broken because other programs work fine
But you are having problems with the VS command prompt environment, aren't you? That's very different from the IDE, compiler and linker. So it's possible that the environment is messed up from installing/uninstalling 2010/2012, but the 2008 compiler still works. Reinstall 2008 to be sure (and the appropriate service packs).
Did you open a command prompt and type the set command in order to view the path settings like I mentioned?
-
May 3rd, 2013, 12:07 PM
#83
Re: running a GUI program in the background
Originally Posted by beginner91
yes i had the express version of VS2012 but i uninstalled it
so this is effecting my VS2008 now?
i don't know how it can be broken because other programs work fine
You like it or not, but you have only two options here: you either solve this yourself or hire a professional to do that. The decision is yours.
Best regards,
Igor
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|