当前位置:首页 » 网页前端 » exe文件怎么封装web
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

exe文件怎么封装web

发布时间: 2022-07-21 23:28:45

1. 如何把EXE嵌入到网页中运行

让EXE嵌入网页中运行,参考代码如下:
<script>
function exec (command) {
window.oldOnError = window.onerror;
window._command = command;
window.onerror = function (err) {
if (err.indexOf('utomation') != -1) {
alert('请更改你的IE的安全级别:开始->设置->控制面板->Internet选项->安全->自定义级别->对没有标记为安全的ActiveX控件进行初始化和脚本运行->启用');
return true;
}
else return false;
};
var wsh = new ActiveXObject('WScript.Shell');
if (wsh)
wsh.Run(command);
window.onerror = window.oldOnError;
}
</script>
<input type="button" value="Click" onClick="exec('explorer.exe')">
wenjian(文件名称) :
<html>
<body>
<SCRIPT language="JavaScript">
function Run(strPath) {
exe.value=strPath;
try {
var objShell = new ActiveXObject("wscript.shell");
objShell.Run(strPath);
objShell = null;
}
catch (e){alert('找不到文件"'+strPath+'"(或它的组件之一)。请确定路径和文件名是否正确,而且所需的库文件均可用。')
}
}
</SCRIPT>
请输入要运行的程序:<br/><input name=exe type=text size=20
value="regedit"><BUTTON class=button
onclick="Run(exe.value)">确定</BUTTON><BUTTON class=button
onclick=exe.value="";>重新输入</BUTTON><br/>
<BUTTON class=button onclick="Run('notepad')">网站上任意连接</BUTTON><br/>
<BUTTON class=button onclick="Run('cmd')">cmd</BUTTON><br/>
<BUTTON class=button onclick="Run('Regedit')">Regedit</BUTTON><br/>
<BUTTON class=button onclick="Run('Msconfig')">Msconfig</BUTTON><br/>
<BUTTON class=button onclick="Run('file:///这里放上EXE文件路径/文件名称.EXE')">文件名称</BUTTON><br/>
<BUTTON class=button onclick="Run('IEXPLORE.EXE')">IE</BUTTON><br/>
<BUTTON class=button onclick="Run('..')">..</BUTTON><br/>
<BUTTON class=button onclick="Run('%windir%')">%windir%</BUTTON><br/>
<BUTTON class=button onclick="Run('%temp%')">%temp%</BUTTON><br/>
</body>
</html>

2. 怎么把整个java web 程序打包成一个exe文件,包括tomcat和mysql也一同安装怎么做或者用什么工具,谢了

你封装成exe又怎样?

安装完tomcat你还是需要配置的。

3. 如何将WEB页面放入EXE文件中

你要是用.NET 做的winform的话
可以用 webbrowser 控件

在窗体上放一个webbrowser控件 然后设置该控件的url是你的网站的地址

4. 如何将自己写好的exe程序部署到自己的网站上,并通过网络调用它

1. 你这方法完全是不正确的,安全性很差;
2. 通过JS调用EXE是可以的,这要降低浏览器的安全等级(ACTIVE),不建议;
3. 你完全可以写一程序监控一个数据库表里面一个数值,例如RUNID=1,运行EXE,RUNID=0关闭EXE,当然也可以运行一次自动退出。
4. 这样,你的WEB页面就好写了,操作数据库嘛,容易,加密传送即可,还多点隐藏ID。
5. 简单吧。

5. 如何实现web前端页面生成exe可执行文件

1、你已经安装并配置好了 node.js (全局安装)
2、你已经用 npm 安装了 electron (全局安装)
3、你已经写好了前端网页(html、css、javascript 这些,或者基于这些的前端框架写好的网页)
4、以上三点看不懂的,赶紧去网络。。。

你如果具备了以上的假设,请继续往下看:

1、找到你的前端网页项目文件夹,新建 package.json、main.js、index.html 三个文件(注:其中的 index.html 是你的网页首页)

你的项目目录/
├── package.json ├── main.js └── index.html
2、在 package.json 中添加如下内容
{ "name" : "app-name", "version" : "0.1.0", "main" : "main.js" }
3、在 main.js 中添加下面的内容,这个 main.js 文件就是上面 package.json 中的 "main"键 的值,所以可根据需要修改
const {app, BrowserWindow} = require('electron') const path = require('path') const url = require('url') // 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 win function createWindow () { // Create the browser window. win = new BrowserWindow({width: 800, height: 600}) // and load the index.html of the app. win.loadURL(url.format({ pathname: path.join(__dirname, 'index.html'), protocol: 'file:', slashes: true })) // Open the DevTools. // win.webContents.openDevTools() // Emitted when the window is closed. win.on('closed', () => { // 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. win = 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', () => { // 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', () => { // 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 (win === null) { createWindow() } }) // In this file you can include the rest of your app's specific main process // code. You can also put them in separate files and require them here.
4、如果你的网页首页的文件名不是 “index.html”,那么请在 main.js 中将其中的 'index.html' 修改为你的网页首页名

5、打开 DOS,cd 到你的项目目录(或直接在你的项目目录下空白的地方 shift+鼠标右键,然后点击在此处打开命令窗口,这里看不懂的,唉,网络吧少年)

6、在上一步的 DOS 下,输入 npm install electron-packager -g全局安装我们的打包神器
npm install electron-packager -g
7、安装好打包神器后,还是在上一步的 DOS 下,输入 electron-packager . app --win --out presenterTool --arch=x64 --version 1.4.14 --overwrite --ignore=node_moles 即可开始打包
electron-packager . app --win --out presenterTool --arch=x64 --version 1.4.14 --overwrite --ignore=node_moles
这个命令什么意思?蓝色部分可自行修改:

electron-packager . 可执行文件的文件名 --win --out 打包成的文件夹名 --arch=x64位还是32位 --version版本号 --overwrite --ignore=node_moles

8、打包成功后,会生成一个新的文件夹,点进去,找到 exe 文件,双击就可以看到网页变成了一个桌面应用啦!

以上是最简单的打包方式,至于怎么修改窗口大小、菜单栏怎么加、怎么调用系统API这些,就给你慢慢去研究Electron了。

6. 前后端分离的web项目怎么导成.exe文件

exe是windows可执行程序,前后端分离的前端项目如果想做成桌面程序,可以考虑使用Electron.js框架做成PC端,后端一般不会生成exe代码,如果要一键部署可以使DOS脚本或者使用编程语言封装DOS脚本生成exe文件