-
July 5th, 2021, 11:07 PM
#1
Can't CreateProcess application?
Hi,
I use the following code to launch excel:
HTML Code:
STARTUPINFO Start;
PROCESS_INFORMATION ProcInfo;
ZeroMemory(&Start, sizeof(STARTUPINFO));
Start.cb = sizeof(Start);
Start.dwFlags = STARTF_USESHOWWINDOW;
LPWSTR pszExcelPath =
L"C:\\Program Files\\Microsoft Office\\Office14\\EXCEL.EXE";
::CreateProcess(NULL, pszExcelPath, 0, 0, 1,
NORMAL_PRIORITY_CLASS, 0, NULL, &Start, &ProcInfo);
but i always get this error,
Exception thrown at 0x00007FF8AB5B7500 (KernelBase.dll) in sap.exe: 0xC0000005: Access violation writing location 0x00007FF81E0E04D4.
How do I fix it?
Thanks you!
-
July 5th, 2021, 11:37 PM
#2
Re: Can't CreateProcess application?
Hi,
I'm not sure but changing the code to worked for me.
::CreateProcess(pszExcelPath,NULL, 0, 0, 1,
NORMAL_PRIORITY_CLASS, 0, NULL, &Start, &ProcInfo);
I've got a new question here.
Please help!
-
July 6th, 2021, 02:48 AM
#3
Re: Can't CreateProcess application?
 Originally Posted by Dang.D.Khanh
Hi,
I'm not sure but changing the code to worked for me.
::CreateProcess(pszExcelPath,NULL, 0, 0, 1,
NORMAL_PRIORITY_CLASS, 0, NULL, &Start, &ProcInfo);
I've got a new question here.
Please help!
It is very clear described in CreateProcess documentation:
lpCommandLine
The command line to be executed.
The maximum length of this string is 32,767 characters, including the Unicode terminating null character. If lpApplicationName is NULL, the module name portion of lpCommandLine is limited to MAX_PATH characters.
The Unicode version of this function, CreateProcessW, can modify the contents of this string. Therefore, this parameter cannot be a pointer to read-only memory (such as a const variable or a literal string). If this parameter is a constant string, the function may cause an access violation.
Victor Nijegorodov
-
July 6th, 2021, 03:11 AM
#4
Re: Can't CreateProcess application?
Hi Sir, Thanks for clarifying.
my big mistake. I corrected my code.
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|