running a GUI program in the background - Page 4
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

Thread: running a GUI program in the background

  1. #46
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,927

    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 online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,291

    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 online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,291

    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
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,266

    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. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  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
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,266

    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. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  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
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,266

    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. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  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
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,266

    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. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center