// HelloWorld.cpp : Defines the entry point for the application.
//
#include "framework.h"
#include "sciter-test.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) {}
LRESULT on_message(HWINDOW hwnd, UINT msg, WPARAM wParam, LPARAM lParam, SBOOL& handled);
bool on_event(HELEMENT he, HELEMENT target, BEHAVIOR_EVENTS type, UINT_PTR reason);
};
// 消息处理函数
LRESULT frame::on_message(HWINDOW hwnd, UINT msg, WPARAM wParam, LPARAM lParam, SBOOL& handled)
{
switch (msg)
{
case WM_SIZE:
;
//case WM_SIZE: on_size(); break;
//case WM_MOVE: on_move(); break;
}
//MessageBox(NULL, _T("hello"),_T("title"),MB_OK);
return 1;
}
// 事件处理函数
bool frame::on_event(HELEMENT he, HELEMENT target, BEHAVIOR_EVENTS type, UINT_PTR reason)
{
switch (type)
{
case BUTTON_PRESS:
::MessageBox(NULL, _T("BUTTON_CLICK"), _T("info"), MB_OK);
break;
}
return false; // false means needing to process next; true means being processed.
}
#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();
}
sciter是一种基于htmlayer的 web ui界面库,比cef,eclectron轻量 ,更适合Windows桌面程序ui.
其它请看教程:
Topic: Sciter, Visual Studio, Windows / sciter