CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 6 of 6 FirstFirst ... 3456
Results 76 to 83 of 83
  1. #76
    Join Date
    Mar 2012
    Posts
    99

    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.

  2. #77
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: running a GUI program in the background

    Quote Originally Posted by beginner91 View Post
    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

  3. #78
    Join Date
    Mar 2012
    Posts
    99

    Re: running a GUI program in the background

    this is the only visual studio command prompt i found:
    Name:  pic.png
Views: 1039
Size:  50.5 KB

  4. #79
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    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.

  5. #80
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    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

  6. #81
    Join Date
    Mar 2012
    Posts
    99

    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

  7. #82
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: running a GUI program in the background

    Quote Originally Posted by beginner91 View Post
    yes i had the express version of VS2012 but i uninstalled it
    so this is effecting my VS2008 now?
    Quite possibly.


    Quote Originally Posted by beginner91 View Post
    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?

  8. #83
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: running a GUI program in the background

    Quote Originally Posted by beginner91 View Post
    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

Page 6 of 6 FirstFirst ... 3456

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