环境:VS2015;
工具:sciter-sdk-master(https://download.csdn.net/download/qq_42095701/11258175);
开发步骤(截图原作者)
在同一个向导中选择项目模型:生命开发周期检查一点要关掉
右键单击VS中的项目,选择“属性”并将“其他包含目录”更改为$(SolutionDir);$(SolutionDir)..\sciter-sdk\include
:
在相同的属性对话框中将输出目录更改为 $(SolutionDir)bin\ 修改成bin目录下最好
让Visual Studio知道您的项目是高DPI感知的:
3.添加到项目文件sciter-sdk / include / sciter-win-main.cpp(项目 - >添加现有项...)
4.使用以下内容创建文件:HelloWorld/HelloWorld.cpp
// HelloWorld.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "HelloWorld.h"
#include "sciter-x-window.hpp"
class frame : public sciter::window {
public:
frame() : window(SW_TITLEBAR | SW_RESIZEABLE | SW_CONTROLS | SW_MAIN | SW_ENABLE_DEBUG) {}
};
#include "resources.cpp"
int uimain(std::function<int()> run) {
//sciter::debug_output_console console; - uncomment it if you will need console window
sciter::archive::instance().open(aux::elements_of(resources)); // bind resources[] (defined in "resources.cpp") with the archive
frame *pwin = new frame();
// note: this:://app URL is dedicated to the sciter::archive content associated with the application
pwin->load(WSTR("this://app/main.htm"));
pwin->expand();
return run();
}
并将其添加到项目菜单:项目 - >添加现有项目...
5.创建子文件夹。在那里你将放置你的HTML / CSS /图像/脚本。 现在把那个内容放在单个文件HelloWorld / res / main.htm中:HelloWorld/res/
<html>
<head>
<title>Test</title>
<style></style>
<script type="text/tiscript"></script>
</head>
<body>
Hello World!
</body>
</html>
6.在项目的根文件夹中,使用以下内容创建名为pack-resources.bat的文件:
..\sciter-sdk\bin\packfolder.exe res resources.cpp -v "resources"
并运行它。它应在同一文件夹中创建文件resources.cpp。这是包含来自/ res /文件夹的资源的压缩二进制blob。注意:每次更改/ res /文件夹中的内容时,都需要运行该.bat文件。您可以将pack-resources.bat调用添加为VS中的项目编译步骤。
现在,您可以在Visual Studio中编译项目(CTRL + SHIFT + B)。
输出文件(HelloWorld.exe)将位于/ bin /文件夹中。
在该文件夹中复制SDK / bin文件夹中与您的编译模型匹配的sciter.dll之一(32或64位)。
并运行HelloWorld.exe。你应该看到这个: