一个Windows下原生SCITer 示例

// 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

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值