How to rename QtWebEngineProcess.exe and make it work?
-
I want to rename QtWebEngineProcess.exe to something more relevant to my project, such as MyProjectBrowser.exe. However, after renaming it, the web engine process fails to start.
What should I do to make it work after renaming the executable?
This is my code:int main(int argc, char** argv) { QString web_engine_process_path; { wchar_t module_path[MAX_PATH]; DWORD result = GetModuleFileName(NULL, module_path, MAX_PATH); if (result > 0 && result < MAX_PATH) { QString current_exe_path = QString::fromWCharArray(module_path); QFileInfo exe_info(current_exe_path); QString exe_dir = exe_info.absolutePath(); web_engine_process_path = QString("%1/%2").arg(exe_dir, "MyProjectBrowser.exe"); web_engine_process_path = QDir::toNativeSeparators(web_engine_process_path); } } qputenv("QTWEBENGINEPROCESS_PATH", web_engine_process_path.toUtf8()); QApplication app(argc, argv); { QFileInfo web_engine_process_file(web_engine_process_path); if (!web_engine_process_file.exists()) { return -1; } } int ret = 0; { QWebEngineView view; view.setUrl(QUrl("https://www.qt.io/")); view.show(); ret = app.exec(); } return ret; }
QT version is 6.7.3
-
I want to rename QtWebEngineProcess.exe to something more relevant to my project, such as MyProjectBrowser.exe. However, after renaming it, the web engine process fails to start.
What should I do to make it work after renaming the executable?
This is my code:int main(int argc, char** argv) { QString web_engine_process_path; { wchar_t module_path[MAX_PATH]; DWORD result = GetModuleFileName(NULL, module_path, MAX_PATH); if (result > 0 && result < MAX_PATH) { QString current_exe_path = QString::fromWCharArray(module_path); QFileInfo exe_info(current_exe_path); QString exe_dir = exe_info.absolutePath(); web_engine_process_path = QString("%1/%2").arg(exe_dir, "MyProjectBrowser.exe"); web_engine_process_path = QDir::toNativeSeparators(web_engine_process_path); } } qputenv("QTWEBENGINEPROCESS_PATH", web_engine_process_path.toUtf8()); QApplication app(argc, argv); { QFileInfo web_engine_process_file(web_engine_process_path); if (!web_engine_process_file.exists()) { return -1; } } int ret = 0; { QWebEngineView view; view.setUrl(QUrl("https://www.qt.io/")); view.show(); ret = app.exec(); } return ret; }
QT version is 6.7.3
@Peal-Wang said in How to rename QtWebEngineProcess.exe and make it work?:
What should I do to make it work after renaming the executable?
Recompile QtWebEngine with the name you want set in the cmake variable 'qtWebEngineProcessName'
https://code.qt.io/cgit/qt/qtwebengine.git/tree/src/core/web_engine_context.cpp#n1233
https://code.qt.io/cgit/qt/qtwebengine.git/tree/src/core/api/CMakeLists.txt#n7 -
@Peal-Wang said in How to rename QtWebEngineProcess.exe and make it work?:
What should I do to make it work after renaming the executable?
Recompile QtWebEngine with the name you want set in the cmake variable 'qtWebEngineProcessName'
https://code.qt.io/cgit/qt/qtwebengine.git/tree/src/core/web_engine_context.cpp#n1233
https://code.qt.io/cgit/qt/qtwebengine.git/tree/src/core/api/CMakeLists.txt#n7@Christian-Ehrlicher Thank you, I compiled the source code as you said, it works