Sciter----交互学习

class Mysciter : public sciter::window
{
public:
	Mysciter() : window(SW_TITLEBAR | SW_RESIZEABLE | SW_CONTROLS | SW_MAIN | SW_ENABLE_DEBUG) { m_pMakePE = NULL; }
	BEGIN_FUNCTION_MAP
		//这里操作传输控件消息
		FUNCTION_0("home_scan", Home_scan);
	END_FUNCTION_MAP


	sciter::value  Home_scan();  //按钮点击出现进度条窗口
	LRESULT on_message(HWINDOW hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL& pHandled); //刷新界面

	Mysciter::~Mysciter(){}

	CMakePeFrame* m_pMakePE;

};

 

//按钮ID是:home-scan class“scan”

//界面显示子界面
sciter::value Mysciter::Home_scan()
{
#if 1
	if (NULL == m_pMakePE)
	{
		m_pMakePE = new CMakePeFrame(this->get_hwnd());

		TCHAR dir[MAX_PATH];
		GetCurrentDirectory(MAX_PATH, dir);//获取当前程序运行目录的路径
		CString path_1 = dir;
		CString path_2 = L"";
		path_2.Format(L"%s\\res_708\\index.html", path_1);  //主界面路径

		// note: this:://app URL is dedicated to the sciter::archive content associated with the application
		m_pMakePE->load(path_2);
		m_pMakePE->expand();
	}
#else
	CMakePeFrame mpFrame;
	mpFrame.load(WSTR("this://app/main_close.htm"));
	mpFrame.expand();
#endif
	return sciter::value();
}

//页面刷新,
LRESULT Mysciter::on_message(HWINDOW hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL& pHandled)
{
	switch (msg)
	{
	case MAKE_PE_CLOST:
		m_pMakePE = NULL;
		break;
	case WM_CLOSE:
		if (m_pMakePE)
		{
			return 0;
		}
		break;
	}
	if (WM_MOVE == msg)
	{
		return 0;
	}
	if (WM_KEYDOWN == msg)
	{
	}
	if (msg == WM_KEYDOWN && wParam == VK_F5)
	{
	}
	return 0;
}

 

html一定要添加:    view.home_scan();用这个跟后端数据交互的一定要加;

  

 

你可能感兴趣的:(sciter)