CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 4 of 6 FirstFirst 123456 LastLast
Results 46 to 60 of 83
  1. #46
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: running a GUI program in the background

    Did you build that what you set up?
    Best regards,
    Igor

  2. #47
    Join Date
    Mar 2012
    Posts
    99

    Re: running a GUI program in the background

    yes it built successfully

  3. #48
    Join Date
    Mar 2012
    Posts
    99

    Re: running a GUI program in the background

    the GUI program i am trying to run is a visual basic program

  4. #49
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: running a GUI program in the background

    Quote Originally Posted by beginner91 View Post
    the GUI program i am trying to run is a visual basic program
    Well, you already mentioned it... two or three times!
    And how could it matter?

    Did you test the Igor's sample?
    Victor Nijegorodov

  5. #50
    Join Date
    Mar 2012
    Posts
    99

    Re: running a GUI program in the background

    Did you test the Igor's sample?
    yes and i got this error:
    [SC] StartService FAILED 2:
    The system cannot find the file specified.

  6. #51
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: running a GUI program in the background

    It only means you set a wrong path/name! Fix it!
    Victor Nijegorodov

  7. #52
    Join Date
    Mar 2012
    Posts
    99

    Re: running a GUI program in the background

    the only line that has a path in it is this:
    Code:
    CString path = GetExeFolderName() + TEXT("C:\\testService\\Debug\\testService.exe");
    and that is the correct path to the exe file so i don't know where the problem is

  8. #53
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: running a GUI program in the background

    Quote Originally Posted by beginner91 View Post
    the only line that has a path in it is this:
    Code:
    CString path = GetExeFolderName() + TEXT("C:\\testService\\Debug\\testService.exe");
    and that is the correct path to the exe file so i don't know where the problem is
    What do you expect path to contain after this statement? Have you examined its contents?
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  9. #54
    Join Date
    Mar 2012
    Posts
    99

    Re: running a GUI program in the background

    What do you expect path to contain after this statement? Have you examined its contents?
    contents of what? i don't understand

  10. #55
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: running a GUI program in the background

    The contents of path. Have you looked at it in the debuuger or shown it on screen to be sure it's what you are expecting as you are concatenating the result of GetExeFolderName() with the TEXT string? As the TEXT string contains both a drive letter and folder names I'm not sure what you are trying to achieve by concatenating this TEXT string with the result of GetExeFolderName().
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  11. #56
    Join Date
    Mar 2012
    Posts
    99

    Re: running a GUI program in the background

    ok so i entered the wrong path name?
    if GetExeFolderName() gets the folder, then the path should just be testService.exe?

  12. #57
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: running a GUI program in the background

    Have you checked what GetExeFolderName is actually returning? As you are hardcoding the full path to your testservice.exe, you probably don't need GetExeFolderName at all at the moment whilst you are testing.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  13. #58
    Join Date
    Mar 2012
    Posts
    99

    Re: running a GUI program in the background

    this is the code for GetExeFolderName
    Code:
    CString GetExeFolderName()
    {
    	TCHAR path[MAX_PATH] = {0};
    	GetModuleFileName(GetModuleHandle(NULL), path, MAX_PATH);
    	LPTSTR p = _tcsrchr(path, _T('\\'));
    	if (p)
    	{
    		*p = TEXT('\0');
    		return path;
    	}
    	return (LPCTSTR)NULL;
    }
    so if i don't need that should i just call the path like this:
    CString path = TEXT("C:\\testService\\Debug\\testService.exe");

  14. #59
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: running a GUI program in the background

    so if i don't need that should i just call the path like this:
    CString path = TEXT("C:\\testService\\Debug\\testService.exe");
    Yes. What debugging of the program have you done - as this should have been picked up by using the debugger.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  15. #60
    Join Date
    Mar 2012
    Posts
    99

    Re: running a GUI program in the background

    can't debug a service program and i can't test the service because of this error
    the service installed fine but it won't start

Page 4 of 6 FirstFirst 123456 LastLast

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