【问题标题】:Electron wix installer icon电子 wix 安装程序图标
【发布时间】:2021-07-25 21:00:18
【问题描述】:

你好,我叫 Alexie,

我的问题是如何从配置中将图标放入电子 wix 安装程序中?

代码如下:

const msiCreator = new MSICreator({
    appDirectory: APP_DIR,
    outputDirectory: OUT_DIR,

    // Configure metadata
    description: 'Optimum cuts',
    exe: 'HyperCut',
    name: 'HyperCut',
    manufacturer: 'Omifa',
    version: '1.0.0',

    // Configure installer User Interface
    ui: {
        enabled: true,
        chooseDirectory: true,
        images: {
            banner: __dirname + '\\ico\\logo.png',
            background: __dirname + '\\ico\\logo_m.jpg'
        }
    },
});

【问题讨论】:

  • Here in the docs appIconPath 属性对你有用吗?
  • 我可能可以提供帮助,但为了澄清......当用户点击您的程序时,您希望图标显示在 UI 中,还是显示您的程序的图标? (即在桌面上)

标签: html electron wix electron-packager


【解决方案1】:

我在 Angular 应用程序中使用 Electron。 我用于图标的代码是下一个:

// Modules to control application life and create native browser window
const { app, BrowserWindow } = require('electron')
const path = require('path')

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow

function createWindow() {
    // Create the browser window.
    mainWindow = new BrowserWindow({
        width: 2024,
        height: 1768,
        minWidth: 400,
        minHeight: 200,
        resizable: true,
        backgroundColor: '#222',
        center: true,
        autoHideMenuBar: true,
        icon: 'produccion.ico',
        label: 'FromScratch',
        title: '',
        webPreferences: {
            preload: path.join(__dirname, 'preload.js')
        }
    })

    // and load the index.html of the app.
    mainWindow.loadFile('Produccion/dist/index.html')

    mainWindow.maximize()

    // Open the DevTools.
    // mainWindow.webContents.openDevTools()

    // Emitted when the window is closed.
    mainWindow.on('closed', function() {
        // Dereference the window object, usually you would store windows
        // in an array if your app supports multi windows, this is the time
        // when you should delete the corresponding element.
        mainWindow = null
    })
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)

// Quit when all windows are closed.
app.on('window-all-closed', function() {
    // On macOS it is common for applications and their menu bar
    // to stay active until the user quits explicitly with Cmd + Q
    if (process.platform !== 'darwin') app.quit()
})

app.on('activate', function() {
    // On macOS it's common to re-create a window in the app when the
    // dock icon is clicked and there are no other windows open.
    if (mainWindow === null) createWindow()
})

【讨论】:

    猜你喜欢
    • 2014-12-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多