dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22

Thread: how to start a MFC.exe using a windows service Application?

  1. #16
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,227

    Re: how to start a MFC.exe using a windows service Application?

    Quote Originally Posted by saraswathisrinath View Post
    Output from Event log:
    UPDATE TESTTABLE SET FLAG = '1' WHERE CNT='1'
    MySQL server has gone away

    Then My Service application stopped. But Status Showing like Started in services.msc. (no service stop option)
    See https://matomo.org/faq/troubleshooting/faq_183/
    and other possible reasons:
    https://www.google.de/search?q=MySQL...hrome&ie=UTF-8
    Victor Nijegorodov

  2. #17
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    6,412

    Re: how to start a MFC.exe using a windows service Application?

    Error 3 means 'The system cannot find the file specified. '

    Code:
    //GetLastError Shud be 0
    Note that GetLastError() is only defined to be valid when CreateProcess() fails. It's value for success is not defined and shouldn't be relied upon. Usually this would be coded something like

    Code:
    if (!CreateProcessAsUser(
          hUserTokenDup,            // client's access token
          _T("C:\\System32\\Test.exe"),              // file to execute
          NULL,     // command line
          NULL,              // pointer to process SECURITY_ATTRIBUTES
          NULL,              // pointer to thread SECURITY_ATTRIBUTES
          FALSE,             // handles are not inheritable
          dwCreationFlags,  // creation flags
          pEnv,              // pointer to new environment block 
          NULL,              // name of current directory 
          &si,               // pointer to STARTUPINFO structure
          &pi                // receives information about new process
       ))
    {
       sTemp.Format("iResultOfCreateProcessAsUser = %d ",GetLastError());
       WriteEventLogEntry( sTemp , EVENTLOG_INFORMATION_TYPE);
    }
    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++17 Compiler: Microsoft VS2017 (15.8.4)

  3. #18
    Join Date
    Nov 2011
    Location
    India
    Posts
    301

    Re: how to start a MFC.exe using a windows service Application?

    Quote Originally Posted by VictorN View Post
    ERROR_PATH_NOT_FOUND
    Thank you
    Corrected my mistakes. wrong path passed C:\\System32\\Test.exe instead of C:\\Windows\\System32\\Test.exe.
    My windows service application working good.


    If PC time forward / Reversed then MySQL server has gone away. So, windows Service application stopped while database update.
    How can i recover from this error?
    Regards,

    SaraswathiSrinath

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

    Re: how to start a MFC.exe using a windows service Application?

    Quote Originally Posted by saraswathisrinath View Post
    If PC time forward / Reversed then MySQL server has gone away. So, windows Service application stopped while database update.
    How can i recover from this error?
    See the post#16
    Victor Nijegorodov

  5. #20
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    12,734

    Re: how to start a MFC.exe using a windows service Application?

    @op. When logging to the event log, log enough info so you can debug. In this case, along with the error code, log the createprocess inputs. Fullpath, arguments, etc.

  6. #21
    Join Date
    Nov 2011
    Location
    India
    Posts
    301

    Re: how to start a MFC.exe using a windows service Application?

    Quote Originally Posted by VictorN View Post
    See the post#16
    will try and get back to you
    Regards,

    SaraswathiSrinath

  7. #22
    Join Date
    Nov 2011
    Location
    India
    Posts
    301

    Re: how to start a MFC.exe using a windows service Application?

    Quote Originally Posted by VictorN View Post
    See the post#16
    edited my.ini, Error Showed like : LOST CONNECTION TO MYSQL SERVER DURING QUERY
    This error showing when time change. other than working good.
    Code:
    [mysqld]
    bind-address = 127.0.0.1 
    
    #Path to installation directory. All paths are usually resolved relative to this.
    basedir="C:/Program Files/MySQL/MySQL Server 5.6/"
    
    #Path to the database root
    datadir="C:/Program Files/MySQL/MySQL Server 5.6/data/"
    
    innodb_buffer_pool_size = 64M
    key_buffer              = 16M
    max_allowed_packet      = 16M
    thread_stack            = 192K
    thread_cache_size       = 8
    innodb_buffer_pool_size = 64M
    
    connect_timeout=28800
    wait_timeout=28800
    interactive_timeout=28800
    
    net_write_timeout=360
    net_read_timeout=360
    
    # Set the SQL mode to strict
    sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
    Regards,

    SaraswathiSrinath

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)