Windows創建Sciter的第一個程序.HelloWorld


介紹什么的就免了.直接進入正題

平台: Windows 10

IDE : Visual studio 2017

首先從官網下載最新的SDK,https://sciter.com/download/

創建流程. https://sciter.com/forums/topic/simple-question-about-sciter/

總結一下關鍵點. (注意:官網教程里的SDK目錄和項目目錄是同級目錄,所以使用了相對路徑,實際項目中要依據情況更改)

1. 將 sciter-sdk\include 加入包含目錄

2. 更改輸出目錄(可選)

3. 更改DPI 識別選項

4. 將 sciter-sdk/include/sciter-win-main.cpp 文件添加到項目

5.替換IDE自動生成的 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();

}

 

6.在項目根目錄下添加 res/main.htm

<html>
    <head>
        <title>Test</title>
        <style></style>
        <script type="text/tiscript"></script>
    </head>
    <body>

      Hello World!

    </body>
</html>

  

7.在項目根目錄下添加 pack-resources.bat . 然后保存運行

..\sciter-sdk\bin\packfolder.exe res resources.cpp -v "resources"

 

8.將 sciter.dll 移動到輸出目錄,即可編譯運行

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM