sciter中文帮助文档跟sciter按钮的交互过程

sciter中文帮助文档:https://download.csdn.net/download/qq_42095701/11285695

按钮交互过程:

1.HTML中看到的声明:view是一个全局函数有他才能两边交互

sciter中文帮助文档跟sciter按钮的交互过程_第1张图片

C++里面的声明与交互关键词(.H):

sciter中文帮助文档跟sciter按钮的交互过程_第2张图片

C++里面的代码实现(CPP):


//这里是进度条的页面

struct thread_params {
	sciter::value taskId;
	sciter::value progressCb; // "progress" callback, function passed from script
	sciter::value doneCb;     // "done" callback, function passed from script
};

void thread_body(thread_params params)  //加载容量流程
{
	for (int i = 1; i <= 100; ++i) {
		::Sleep(100);
		params.progressCb.call(i); // 这里发送进度条进度值
	}
	// report task completion,
	// we can pass some result data here, for now just taskId
	params.doneCb.call(params.taskId);  //这里给结构体里面的ID值
}

void my_thread(thread_params params)   //上面加载进度条容量加载
{
	for (int i = 1; i <= 100; ++i) {
		::Sleep(500);
		params.progressCb.call(i); // report task progress, function will be executed in GUI thread
	}
	// report task completion,
	// we can pass some result data here, for now just taskId
	params.doneCb.call();
}
CMakePeFrame::~CMakePeFrame()
{
	EnableWindow(hwndParent, TRUE);
	SetForegroundWindow(hwndParent);
	::PostMessage(hwndParent, MAKE_PE_CLOST, 0, 0);
	dismiss();
}
sciter::value CMakePeFrame::exec_task(sciter::value taskId, sciter::value progressCb, sciter::value doneCb)
{   //小进度条按钮点击后操作
	thread_params params;
	params.taskId = taskId;
	params.progressCb = progressCb;
	params.doneCb = doneCb;

	sciter::thread(thread_body, params);
	return sciter::value(); // void method
}
sciter::value CMakePeFrame::execMyTask(sciter::value progressCb, sciter::value doneCb)  
{
	//大进度条点击按钮
	thread_params params;
	params.progressCb = progressCb;
	params.doneCb = doneCb;

	sciter::thread(my_thread, params);
	return sciter::value(); // void method
}

//必须存在。相当于刷新界面
LRESULT CMakePeFrame::on_message(HWINDOW hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL& pHandled)
{
	if (WM_MOVE == msg)
	{
		return 0;
	}
	if (WM_KEYDOWN == msg)
	{
	}
	if (msg == WM_KEYDOWN && wParam == VK_F5)
	{
	}
	return 0;
}

CPP做的是交互后的处理;

你可能感兴趣的:(MFC,第一次工作,sciter)