Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. How to rename QtWebEngineProcess.exe and make it work?
Forum Updated to NodeBB v4.3 + New Features

How to rename QtWebEngineProcess.exe and make it work?

Scheduled Pinned Locked Moved Unsolved QtWebEngine
3 Posts 2 Posters 252 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Peal Wang
    wrote on last edited by
    #1

    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

    Christian EhrlicherC 1 Reply Last reply
    0
    • P Peal Wang

      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

      Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      P 1 Reply Last reply
      1
      • Christian EhrlicherC Christian Ehrlicher

        @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

        P Offline
        P Offline
        Peal Wang
        wrote on last edited by
        #3

        @Christian-Ehrlicher Thank you, I compiled the source code as you said, it works

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved