Example #1
0
 void STipCtrl::RelayEvent( const MSG *pMsg )
 {
     switch(pMsg->message)
     {
     case WM_LBUTTONDOWN:
     case WM_LBUTTONUP:
     case WM_RBUTTONDOWN:
     case WM_RBUTTONUP:
     case WM_MBUTTONUP:
     case WM_MBUTTONDOWN:
         OnTimer(TIMERID_SPAN);//hide tip
         break;
     case WM_MOUSEMOVE:
         {
             CPoint pt(GET_X_LPARAM(pMsg->lParam),GET_Y_LPARAM(pMsg->lParam));
             if(!m_rcTarget.PtInRect(pt))
             {
                 OnTimer(TIMERID_SPAN);//hide tip
             }
             else if(!IsWindowVisible() && !m_strTip.IsEmpty())
             {
                 KillTimer(TIMERID_DELAY);
                 SetTimer(TIMERID_DELAY,m_nDelay);
                 ::ClientToScreen(pMsg->hwnd,&pt);
                 SetWindowPos(0,pt.x,pt.y+24,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOSENDCHANGING|SWP_NOACTIVATE);
             }
         }
         break;
     }
 }
void CIOCP_ClientDlg::OnBnClickedStopTest()
{
	UpdateData(TRUE);
	GetDlgItem(IDB_STOP_TEST)->EnableWindow(FALSE);
	
	m_IOCPModel.EndTest();
	ClientDB::GetInstance()->ExecuteSQL(TEXT("COMMIT;"));			// 提交事务
	KillTimer(ID_TIMER_FRESH_INTERVAL);
	OnTimer(ID_TIMER_FRESH_INTERVAL);
	KillTimer(ID_TIMER_PER_SEC);
	OnTimer(ID_TIMER_PER_SEC);
	MessageBox(_T("测试已完成!"),_T("提示"), MB_OK);
	GetDlgItem(IDB_START_TEST)->EnableWindow(TRUE);
}
Example #3
0
LRESULT RootWindow::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg) 
    {
        case WM_CREATE:
            return OnCreate();  

        case WM_MOUSEMOVE:
            return OnMouseMove(wParam, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
        
        case WM_NCDESTROY:
            KillTimer(m_hwnd, ANIM_TIMER_ID);
            // Death of the root window ends the thread
            PostQuitMessage(0);
            break;

        case WM_SETFOCUS:
            if (NULL != m_hwndChild)
                SetFocus(m_hwndChild);
            return 0;

        case WM_TIMER:
            OnTimer();
            return 0;

        case WM_KEYDOWN:
            OnKeyDown(wParam, lParam);
            return 0;
    }
    
    return super::HandleMessage(uMsg, wParam, lParam);
}
Example #4
0
bool CMixer::Exclusive(bool Enable, const DISPLAY_MODE_INFO *ModeInfo)
{
	if (Enable == m_IsExclusive)
		return(TRUE);	// nothing to do
	bool	retc = FALSE;	// assume failure
	if (Enable) {
		if (GetCurView() == NULL)	// if no view
			return(FALSE);	// exclusive mode is useless
		CString	ErrMsg;
		if (CreateBackBuf(ErrMsg, ModeInfo)) {	// create back buffer
			ApplySettings();
			OnTimer(FRAME_TIMER_ID);	// display first frame
			retc = TRUE;	// success
		} else {	// create back buffer failed
			DestroyBackBuf();
			if (ErrMsg.IsEmpty())	// if specific error message wasn't set
				ErrMsg.LoadString(IDS_CANT_SET_EXCLUSIVE);	// use generic message
			AfxMessageBox(ErrMsg);
		}
	} else {	// disable exclusive
		DestroyBackBuf();
		retc = TRUE;	// success
	}
	theApp.UpdateAllViews(NULL, CFracticeView::UVH_EXCLUSIVE, NULL);
	return(retc);
}
OpenGLOutput::OpenGLOutput()
:QDialog()
{
    ui = new Ui::OpenGLOutputDialog();
    ui->setupUi(this);

    layout = new QGridLayout(ui->previewContainer);
    layout->setMargin(0);

    previewView = new CDeckLinkGLWidget(this);
    previewView->resize(ui->previewContainer->size());
    previewView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    layout->addWidget(previewView, 0, 0, 0, 0);
    previewView->DrawFrame(NULL);

    pOpenGLOutput = new BMDOpenGLOutput();

	if (!pOpenGLOutput->InitDeckLink())
		exit(0);
	if (!pOpenGLOutput->InitGUI(previewView))
		exit(0);
	if (!pOpenGLOutput->InitOpenGL())
		exit(0);

	pTimer = new QTimer(this);
	connect(pTimer, SIGNAL(timeout()), this, SLOT(OnTimer()));

	setWindowTitle("OpenGLOutput");
    show();
}
Example #6
0
LRESULT WINAPI WndProc( HWND hWnd, UINT nMsg,
                        WPARAM wParam, LPARAM lParam )
{
    switch( nMsg )
    {
    case WM_PAINT:
        OnPaint( hWnd );
        break;
    case WM_TIMER:
        OnTimer( hWnd, wParam );
        break;
    case WM_CREATE:
    {
        SetTimer( hWnd, 1, 10, NULL );
//			SetTimer( hWnd, 2, 2000, TimerProc );
        //最后一个参数是否为NULL,将影响 这个定时器
        //触发WM_TIMER消息,找谁处理。
    }
    break;
    case WM_DESTROY:
        PostQuitMessage( 0 );
        break;
    }
    return DefWindowProc( hWnd, nMsg, wParam, lParam );
}
	void CFadeButtonUI::DoEvent(TEventUI& event)
	{
		if( event.Type == UIEVENT_MOUSEENTER && !IsAnimationRunning( FADE_IN_ID ) )
		{
			m_bFadeAlpha = 0;
			m_bMouseHove = TRUE;
			StopAnimation( FADE_OUT_ID );
			StartAnimation( FADE_ELLAPSE, FADE_FRAME_COUNT, FADE_IN_ID );
			Invalidate();
			return;
		}
		if( event.Type == UIEVENT_MOUSELEAVE && !IsAnimationRunning( FADE_OUT_ID ) )
		{
			m_bFadeAlpha = 0;
			m_bMouseLeave = TRUE;
			StopAnimation(FADE_IN_ID);
			StartAnimation(FADE_ELLAPSE, FADE_FRAME_COUNT, FADE_OUT_ID);
			Invalidate();
			return;
		}
		if( event.Type == UIEVENT_TIMER ) 
		{
			OnTimer(  event.wParam );
		}
		CButtonUI::DoEvent( event );
	}
Example #8
0
Cron::Cron() {
	LogInfo("Cron Started...");
	// Conmpute next slot
	int now = QDateTime::currentDateTime().toTime_t();
	QTimer::singleShot(1000 * (60 - (now%60)), this, SLOT(OnTimer()));
	lastGivenID = 0;
}
void CSnakeView::OnStart()
{
	// TODO: 在此添加命令处理程序代码
	gameStart = 1;
	Initialize();
	OnTimer(1);
}
Example #10
0
int CMainFrame::MsgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
  switch (uMsg)
  {
    case WM_COMMAND:
      OnCommand(wParam, lParam);
      break;
    case WM_CREATE:
      OnCreate(wParam, lParam);
      break;
    case WM_DESTROY:
      OnDestroy(wParam, lParam);
      break;
    case WM_SIZE:
      OnSize(wParam, lParam);
      return 1;
    case WM_TIMER:
      OnTimer(wParam, lParam);
      return 1;
    case WM_ERASEBKGND:
      return 0;
  }

  return DefFrameProc(m_hWnd, m_hClient, uMsg, wParam, lParam);
}
Example #11
0
LRESULT CTrayIconHooker::WindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam)
{
  ASSERT(m_pTrayIcon);
  LRESULT lResult = 0;

  if (nMsg == wm_TaskbarCreated)
    lResult = OnTaskbarCreated(wParam, lParam);
  else
  {
    switch (nMsg)
    {
      case WM_TIMER: 
      {
        if (wParam == m_pTrayIcon->m_NotifyIconData.uID)  //It's our timer
          OnTimer(wParam); 
        else
          lResult = Default();
        break;
      }
      default: 
      {
        lResult = Default(); 
        break;
      }
    }
  }

  return lResult;
}
Example #12
0
LRESULT WINAPI ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
	case WM_CREATE:
		InitSaver(hWnd);
		break;

	case WM_TIMER:
		OnTimer(hWnd, (UINT)wParam);
		break;

	case WM_DESTROY:
		KillTimer(hWnd, IDT_TIMER);
		PostQuitMessage(0);
		return 0;

	case WM_KEYDOWN:
#ifdef DEBUG_MODE // in debug mode, user can exit program by press "ESC"
		if(VK_ESCAPE == wParam)
			PostQuitMessage(0);
#endif
		if(IsMagicKey((char)wParam))
			return 0;
		break;
	}

#ifndef DEBUG_MODE
	return DefScreenSaverProc(hWnd, message, wParam, lParam);
#else
	return DefWindowProc(hWnd, message, wParam, lParam);
#endif
}
Example #13
0
void CComboBoxExt::OnCbnSelendCandel()
{
	CClientDC dc(this);
	m_bPress=FALSE;
	dc.DeleteDC();
	OnTimer(1001);
}
Example #14
0
void App::OnKeyboard(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
	switch (message) {
		case WM_KEYUP:

		break;

		case WM_KEYDOWN:

		break;

		case WM_CHAR: {
			switch (wParam) {
				case 'k':
					KillHalf(hwnd);
				break;

				case 'x':
					PostQuitMessage(0);
				break;

				// Temporary thing to fasten the program
				case ' ':
					OnTimer(hwnd);
				break;
			}
		}
		break;

		default:

		break;
	}
}
Example #15
0
int main(int argc,char ** argv)
{
    // start GL context and O/S window using the GLFW helper library
    appDelegate.AppWillStart();
    FPS_Helper fpsHelper;
    fpsHelper.SetFixedFPS(30);
    InitOpenGL();

    appDelegate.AppDidStart();

    while (!glfwWindowShouldClose (mainWnd.window))
    {
        // wipe the drawing surface clear
        static double timer_last = 0;
        double curr_time = glfwGetTime();
        if(curr_time - timer_last > 0.2)
        {
            timer_last = timer_last + 0.02;
            OnTimer();
        }

        if(fpsHelper.Tick())
        {
            OnRender();
            // update other events like input handling
            glfwPollEvents ();
            // put the stuff we've been drawing onto the display
            glfwSwapBuffers (mainWnd.window);
        }
    }
    // close GL context and any other GLFW resources
    appDelegate.AppWillTerminate();
    glfwTerminate();
    return 0;
}
Example #16
0
void CEditLog::AddText( 
		LPCWSTR pwszAdd,
		bool bLFtoCRLF	// = false
		)
{
	if( pwszAdd ) {
		::EnterCriticalSection( &m_csLock );
		if( bLFtoCRLF ) {
			// Add text to our buffer, but convert each LF to a CRLF pair
			int cchAdd = ::wcslen( pwszAdd );
			// Ensure no buffer enlargement operations are necessary 			
			m_wsStore.reserve( m_wsStore.length() + cchAdd * 2 );
			for( int i = 0; i < cchAdd; ++i ) {
				if( pwszAdd[ i ] == L'\n' )
					m_wsStore += L'\r';
				m_wsStore += pwszAdd[ i ];
			}
		}
		else
			// Simly add text
			m_wsStore += pwszAdd;

		// If the log is filled really fast or the UI thread is doing something
		// else, the WM_ADDTEXT messages may not get processed for a long period.
		// To avoid floating the UI threads message queue, we post only one message.
		if( !m_bMessagePending && GetHandle() != NULL ) {
			::PostMessage( GetHandle(), WM_ADDTEXT, 0, 0 );
			m_bMessagePending = true;
		}
		::LeaveCriticalSection( &m_csLock );
	}

	OnTimer(0);

}
Example #17
0
BOOL CInputBox::ProcSubHandler(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
	switch (iMsg) {
	case WM_INITDIALOG:
		if (m_hWnd == NULL)
			m_hWnd = hDlg;
		return OnInitDialog();
	case WM_SIZE:
 		OnSize((UINT)wParam, LOWORD(lParam), HIWORD(lParam));
		return TRUE;
	case WM_GETMINMAXINFO:
		OnGetMinMaxInfo((LPMINMAXINFO) lParam);
		return TRUE;
 	case WM_TIMER:
 		OnTimer((UINT)wParam);
  		return TRUE;
	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDOK:
			OnOK();
			return TRUE;
		case IDCANCEL:
			OnCancel();
			return TRUE;
		default:
			return FALSE;
		}
	default:
		return FALSE;
	}
}
Example #18
0
 Keyboard(wxWindow *parent)
 :   wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(0, kWhiteKeyHeight))
 {
     img_white_          = LoadImage(L"pianokey_white.png");
     img_white_pushed_   = LoadImage(L"pianokey_white_pushed.png");
     img_white_pushed_contiguous_   = LoadImage(L"pianokey_white_pushed_contiguous.png");
     img_black_          = LoadImage(L"pianokey_black.png");
     img_black_pushed_   = LoadImage(L"pianokey_black_pushed.png");
     
     img_white_.Rescale(kKeyWidth, kWhiteKeyHeight);
     img_white_pushed_.Rescale(kKeyWidth, kWhiteKeyHeight);
     img_white_pushed_contiguous_.Rescale(kKeyWidth, kWhiteKeyHeight);
     img_black_.Rescale(kKeyWidth+1, kBlackKeyHeight);
     img_black_pushed_.Rescale(kKeyWidth+1, kBlackKeyHeight);
     
     Bind(wxEVT_PAINT, [this](auto &ev) { OnPaint(); });
     
     timer_.Bind(wxEVT_TIMER, [this](auto &ev) { OnTimer(); });
     timer_.Start(50);
     Bind(wxEVT_LEFT_DOWN, [this](auto &ev) { OnLeftDown(ev); });
     Bind(wxEVT_LEFT_DCLICK, [this](auto &ev) { OnLeftDown(ev); });
     Bind(wxEVT_LEFT_UP, [this](auto &ev) { OnLeftUp(ev); });
     Bind(wxEVT_MOTION, [this](auto &ev) { OnMotion(ev); });
     Bind(wxEVT_KEY_DOWN, [this](auto &ev) { OnKeyDown(ev); });
     Bind(wxEVT_KEY_UP, [this](auto &ev) { OnKeyUp(ev); });
     
     key_code_for_sample_note_.fill(0);
 }
Example #19
0
	/**
	 * ダイアログメッセージをメッセージを各関数に振り分けるだけです。
	 * @return TRUE(1)のときメッセージを処理
	 */
	INT_PTR DlgProc(
		HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
	{
		switch(Message){
		case WM_INITDIALOG:
			return OnInitDialog(hWnd, (HWND)wParam, lParam);
		case WM_DESTROY:
			return OnDestroy(hWnd);
		case WM_CLOSE:
			return OnClose(hWnd);
		case WM_COMMAND:
			return OnCommand(
				hWnd,
				(int)(LOWORD(wParam)),
				(HWND)(lParam),
				(UINT)HIWORD(wParam));
		case WM_NOTIFY_ICON:
			OnNotifyIcon(hWnd, wParam, lParam);
			return TRUE;
		case WM_TIMER:
			OnTimer(hWnd, wParam);
			return 0;
		}
		return FALSE;
	}
Example #20
0
int CDuffDlg::Search()
{

	m_Status.SetWindowText( StringFromResource(IDS_STATUS_BUSY) );
	if (m_bAnimateControl)
	{
		m_AnimateControl.ShowWindow(SW_SHOW);
		m_AnimateControl.Play(ALL);
	}
	g_DupeFileFind.StartSearch();

	if (m_bAnimateControl)
	{
	 m_AnimateControl.Stop();
	}

	m_Status.SetWindowText( StringFromResource(IDS_STATUS_IDLE) );


	OnTimer(TIMER_PROGRESS);
	KillTimer(TIMER_PROGRESS);

	if ( theApp.m_DuffOptions.Sound.Enabled )
		PlaySoundFile( theApp.m_DuffOptions.Sound.ProcessComplete );

 return 0;
}
Example #21
0
void CclockDlg::OnPaint()
{
	
	if (IsIconic())
	{
		CPaintDC dc(this); // 用于绘制的设备上下文

		SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);

		// 使图标在工作区矩形中居中
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// 绘制图标
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		OnTimer(m_timer);
		CDialog::OnPaint();
	}	
}
Example #22
0
static LRESULT CALLBACK TaskWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
	switch (msg) {
		case WM_CREATE:
			OnCreate(hWnd);
			return 0;

		case WM_ERASEBKGND:
			return 0;

		case WM_PAINT:
			OnPaint(hWnd);
			return 0;

		case WM_TIMER:
			OnTimer(wParam);
			return 0;

		case WM_HOTKEY:
			return OnHotKey(HTaskWnd, wParam, lParam);

		case WM_DESTROY:
			OnDestroy();
			return 0;

		default:
			return DefWindowProc(hWnd, msg, wParam, lParam);
	}
}
Example #23
0
BOOL CEditLog::ProcessWindowMessage(
		UINT uMsg,
		WPARAM wParam,
		LPARAM lParam,
		LRESULT& lResult 
		)
{
	lResult = 0;
	switch( uMsg ) {
		case WM_DESTROY:
			OnDestroy();
			return TRUE;
		case WM_TIMER:
			OnTimer( (UINT) wParam );
			return TRUE;
		case WM_ADDTEXT:
			if( !OnAddText() && m_nTimerID == 0 )
				m_nTimerID = ::SetTimer( GetHandle(), 4711, m_nTimerDelay, NULL );
			return TRUE;
		case WM_ERASEBKGND:
			if( m_bNoPaint )
				return TRUE;
		case WM_PAINT:
			if( m_bNoPaint )
				return TRUE;
	}

	return root_type::ProcessWindowMessage( uMsg, wParam, lParam, lResult );
}
Example #24
0
void  CGuiComboFont::OnCloseup() 
{
	// TODO: Add your control notification handler code here
	CClientDC dc(this);
	m_bPress = FALSE;
	OnTimer(1);
}
Example #25
0
static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg)
	{
		case WM_CREATE:
			OnCreate(hwnd);
			break;
#ifndef WINCE
		case WM_DROPFILES:
			OnDropFiles((HDROP)wParam);
			break;
#endif
		case WM_COMMAND:
			OnCommand((HWND)lParam);
			break;
		case WM_HSCROLL:
			OnHScroll(hwnd, LOWORD(wParam), HIWORD(wParam));
			break;
		case WM_SIZE:
			OnSize(hwnd);
			break;
		case WM_TIMER:
			OnTimer(hwnd);
			break;
		case WM_CLOSE:
			OnClose(hwnd);
			delete g_pPlayer;
			delete g_pGoodlayer;
			break;
		case WM_DESTROY:
			PostQuitMessage(0);
			return 0;
	}
	return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
LRESULT CFuncKeyWnd::DispatchEvent(
	HWND	hwnd,	// handle of window
	UINT	uMsg,	// message identifier
	WPARAM	wParam,	// first message parameter
	LPARAM	lParam 	// second message parameter
)
{
//	if( NULL == GetHwnd() ){
//		return 0L;
//	}

	int		i;
	WORD	wNotifyCode;
	WORD	wID;
	HWND	hwndCtl;
	switch ( uMsg ){

	case WM_TIMER:		return OnTimer( hwnd, uMsg, wParam, lParam );
	case WM_COMMAND:	return OnCommand( hwnd, uMsg, wParam, lParam );
	case WM_SIZE:		return OnSize( hwnd, uMsg, wParam, lParam );
	case WM_DESTROY:	return OnDestroy( hwnd, uMsg, wParam, lParam );

	default:
		return DefWindowProc( hwnd, uMsg, wParam, lParam );
	}
}
Example #27
0
LRESULT NativeWindow::HandleMessages(UINT message, WPARAM wParam, LPARAM lParam)
{
	switch(message)
	{
		case WM_ERASEBKGND:
			return OnEraseBkgnd();
		case WM_TIMER:
			{
				OnTimer((UINT)wParam);
			}
			break;
		case WM_SIZE:
			{
				int cx = LOWORD(lParam);
				int cy = HIWORD(lParam);
				OnSize((UINT)wParam,cx,cy);
			}
			break;
		case WM_GETMINMAXINFO:
			{
				OnGetMinMaxInfo((MINMAXINFO *)lParam);
			}
			break;
		default:
			break;;
	}
	return CallWindowProc(old_window_proc_,hwnd_, message, wParam, lParam);
}
Example #28
0
//---------------------------------------------------------------------
//---------------------------------------------------------------------
BOOL CALLBACK Main_DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
	switch (uMsg) {
	case WM_INITDIALOG:
		//SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_TOOLWINDOW);
		//SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_HIDEWINDOW);
		
		// 明るい赤と明るい緑のブラシを作成
		s_hbrW = CreateSolidBrush(RGB(255, 255, 255));
		s_hbrR = CreateSolidBrush(RGB(255, 200, 200));
		s_hbrG = CreateSolidBrush(RGB(200, 255, 200));
		DragAcceptFiles(hwnd, TRUE);
		return TRUE;

	case WM_CLOSE:
		DeleteObject(s_hbrW);
		DeleteObject(s_hbrR);
		DeleteObject(s_hbrG);
		EndDialog(hwnd, 0);
		return TRUE;

	case WM_COMMAND:
		return OnCommand(hwnd, LOWORD(wParam), HIWORD(wParam));

	case WM_CTLCOLORSTATIC:
		return OnCtlColorStatic(hwnd, (HDC)wParam, (HWND)lParam);

	case WM_DROPFILES:
		return OnDropFiles(hwnd, (HDROP)wParam);

	case WM_TIMER:
		return OnTimer(hwnd);
	}

	return FALSE;
}
Example #29
0
LRESULT CLrcMask::ProcessWindowMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	if(uMsg==WM_TIMER)
		return OnTimer(uMsg,wParam,lParam,bHandled);
	if(uMsg==WM_PAINT)
		return OnPaint(uMsg,wParam,lParam,bHandled);
	return __super::ProcessWindowMessage(uMsg,wParam,lParam,bHandled);
}
Example #30
0
  virtual void Show(const PixelRect &rc) override {
    RowFormWidget::Show(rc);
    Timer::Schedule(500);

    OnTimer();
    SetButtons();
    SetBallast();
  }