窗口事件注册

窗口C方式注册事件

//pbHandled:是否拦截
int CALLBACK OnWndRButtonDown(UINT flags,POINT *pPt,BOOL *pbHandled)
{
//事件响应
return 0;
}
int CALLBACK OnWndRButtonDown1(HWINDOW hWindow,UINT nFlags,POINT *pPt, BOOL *pbHandled)
{
//事件响应
return 0;
}
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
XInitXCGUI(TRUE);
HWINDOW hWindow = XWnd_Create(0, 0, 300, 200, L"炫彩界面库窗口",NULL, window_style_default);
XWnd_RegEventC(hWindow,WM_RBUTTONUP,OnWndRButtonDown);//注册事件
XWnd_RegEventC1(hWindow,WM_RBUTTONUP,OnWndRButtonDown1);//注册事件
XWnd_ShowWindow(hWindow,SW_SHOW);
return 0;
}
@ window_style_default
窗口样式-控制按钮: 居中 图标, 标题, 关闭按钮, 最大化按钮, 最小化按钮
Definition: XCGUI.h:331
void WINAPI XExitXCGUI()
炫彩_退出 退出界面库释放资源.
Definition: App.cpp:513
void WINAPI XRunXCGUI()
炫彩_运行 运行消息循环,当炫彩窗口数量为0时退出.
Definition: App.cpp:506
BOOL WINAPI XInitXCGUI(BOOL bD2D)
炫彩_初始化 初始化界面库.
Definition: App.cpp:499
XWnd_RegEventC1(hWindow, nEvent, memberFunction)
窗口_注册事件C1 注册窗口事件, 回调函数不省略参数.
XWnd_RegEventC(hWindow, nEvent, memberFunction)
窗口_注册事件C 注册窗口事件, 回调函数省略参数窗口自身句柄hWindow.
HWINDOW WINAPI XWnd_Create(int x, int y, int cx, int cy, const wchar_t *pTitle, HWND hWndParent, int XCStyle)
窗口_创建 创建窗口
Definition: WindowUI.cpp:5570
BOOL WINAPI XWnd_ShowWindow(HWINDOW hWindow, int nCmdShow)
@窗口_显示扩展 显示隐藏及控制窗口最大化还原等
Definition: WindowUI.cpp:5979

窗口C++方式注册事件

class CMyWindow
{
public:
HWINDOW m_hWindow;
CMyWindow(){
Init();
}
void Init()
{
m_hWindow = XWnd_Create(0, 0, 300, 200, L"炫彩界面库窗口",NULL, window_style_default);
XWnd_RegEventCPP(m_hWindow,WM_RBUTTONUP,&CMyWindow::OnWndRButtonDown);//注册事件
XWnd_RegEventCPP1(m_hWindow,WM_RBUTTONUP,&CMyWindow::OnWndRButtonDown1);//注册事件
XWnd_ShowWindow(m_hWindow,SW_SHOW);
}
//pbHandled:是否拦截
int OnWndRButtonDown(UINT flags,POINT *pPt,BOOL *pbHandled)
{
//事件响应
return 0;
}
int OnWndRButtonDown1(HWINDOW hWindow,UINT nFlags,POINT *pPt, BOOL *pbHandled)
{
//事件响应
return 0;
}
};
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
XInitXCGUI(TRUE);
CMyWindow MyWindow;
return 0;
}
XWnd_RegEventCPP1(hWindow, nEvent, memberFunction)
窗口_注册事件CPP1 注册窗口事件,将类成员函数作为事件响应函数.函数不省略参数.
XWnd_RegEventCPP(hWindow, nEvent, memberFunction)
窗口_注册事件CPP 注册窗口事件,将类成员函数作为事件响应函数.函数省略参数窗口自身句柄hWindow.