Weird CreateProcess Parameters

Source: Internet
Author: User

Since you recently want to write a gtest UI test, you need to create a process and send messages to it. However, the CreateProcess function always fails at the beginning.

Test (clean_up_tests, time_table_dlg) <br/>{< br/> startupinfo sistartinfo; <br/> process_information piprocinfo; <br/> // set up members of startupinfo structure. <br/> sistartinfo. CB = sizeof (startupinfo); <br/> sistartinfo. lpreserved = NULL; <br/> sistartinfo. lpreserved2 = NULL; <br/> sistartinfo. cbreserved2 = 0; <br/> sistartinfo. lpdesktop = NULL; <br/> sistartinfo. dwflags = 0; </P> <p> // The specified line <br/> tchar sz1_line [_ max_path] = _ T ("planet.exe "); </P> <p> int ncreateresult = <br/> CreateProcess (null, szcmdline, <br/> null, null, false, 0, null, null, & sistartinfo, & piprocinfo); <br/> //...... <br/>}< br/>

I found all kinds of information, but I cannot find the reason. Bored, when I put startupinfo and process_information struct definitions outside the test () function as a global variable, the situation turned around. Does the scope of these two variables affect the function execution process? However, I have searched various usage instructions on these two variables, and I have not mentioned this point. I will post this phenomenon. If it can help people who are encountering this problem, I am very lucky.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.