窗口隐藏代码
- XXXX::OnInitDialog()
- {
- ModifyStyleEx(WS_EX_APPWINDOW, WS_EX_TOOLWINDOW);
- WINDOWPLACEMENT wp;wp.length=sizeof(WINDOWPLACEMENT);
- GetWindowPlacement(&wp);wp.flags=WPF_RESTORETOMAXIMIZED;
- wp.showCmd=SW_HIDE;SetWindowPlacement(&wp);
- SetWindowPos(NULL,0,0,0,0,SWP_NOZORDER);
- }
- XXXX::::OnPaint()
- {
- ShowWindow(SW_HIDE);
- }
MFC U盘检测
XXXdlg.h
- afx_msg BOOL OnDeviceChange(UINT nEventType, DWORD dwData);
XXXdlg.cpp
- BEGIN_MESSAGE_MAP(XXXDlg, CDialog)
- ON_WM_SYSCOMMAND()
- ON_WM_PAINT()
- ON_WM_QUERYDRAGICON()
- ON_WM_TIMER()
- ON_WM_DEVICECHANGE()//添加这一条
- END_MESSAGE_MAP()
- BOOL XXXDlg::OnDeviceChange(UINT nEventType, DWORD dwData)
- {
- if( nEventType == DBT_DEVICEREMOVECOMPLETE )
- {
- AfxMessageBox("asasa");
- }
- return 1 ;