封装Sciter2到CWnd子类 关键词:sciter2、MFC、CWnd
以前一直用MFC做界面,虽有朋友推荐多种界面设计,但也就看看,从没真正去了解。最近帮朋友做导航界面,明确要求用HTMLayout,网上搜索了下,看了下介绍,感觉sciter2比HTMLayout做的界面还炫丽,朋友同意后,今天就开始接触。目的是继承CWnd,生成sciterWnd,然后将sciter2封装在里面,通过换html文件来更好sciterWnd界面设计。做了一下午,搞的差不多了,记录下。
sciter2下载地址:http://www.terrainformatica.com/sciter2/main.whtm
直接下载Sciter2 SDK就可以了,里面包含了所有的头文件、lib和dll文件。
由于刚刚接触Sciter2,对其原理和用法不了解,加之其给的例子是win32 SDK下的,并且用法很奇怪,在分析了这些例子后,还是没有理清楚头绪,回头又看官网的说明:感觉这个比较有用:http://www.terrainformatica.com/sciter/sciter-basics.whtm ,其实还是很简单的,只用到一下三个函数:
SciterProcND
SciterSetCallback
SciterLoadFile
以下是测试界面,加载的是Sciter2例子里面的test-slide.htm。
关于消息传递还在整理中
To be able to handle events in native code you will need to attach instance of sciter::event_handler
class to existing DOM element or to the window itself.
event_handler attached to the window will receive all DOM events no matter which element they are targeted to.
sciter::event_handler
contains various methods - receivers of events of various types. You can override any of these methods in order to receive events you are interested in your implementation of sciter::event_handler
class.
【Sciter2 之一(封装Sciter2到CWnd的子类中)】