예제 #1
0
void
TipButton::previousTip()
	{
	--_nTipOfTheDay;
	if ( _nTipOfTheDay < 0 )
		_nTipOfTheDay = _nTips-1;

	drawTipText();
	}
예제 #2
0
void
TipButton::nextTip()
	{
	++_nTipOfTheDay;
	if ( _nTipOfTheDay >= _nTips )
		_nTipOfTheDay = 0;

	drawTipText();
	}
예제 #3
0
void
TipButton::feel( int mouse )
	{
	init_dialog( Tip, NULL, NULL );
	ready_dialog( Tip, NULL, NULL, tip_feel, NULL, NULL, NULL );
	center_dialog( Tip );
	save_under_dialog( Tip );
	draw_dialog( Tip );

	//CRASH//debug( "Render icon" );
	gfx_blit( kyle_icon_data, Tip[ICON].sx, Tip[ICON].sy,
		Tip[ICON].width, Tip[ICON].height, 15 );

	_nTipOfTheDay = rand() % _nTips;
	drawTipText();

	do_dialog( Tip, -1 );
	restore_under_dialog();

	dialog_done = 0;			// override inside dialog box's setting
	}
예제 #4
0
//主窗口回调函数
LRESULT CALLBACK WndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
{
	static HWND hBtn[5];
	LOGFONT		lf;
	HDC			hdc;
	PAINTSTRUCT ps;
	char		btnLab[10];
	HFONT		hFont;

	strcpy( lf.lfFaceName, "Arial" );
	lf.lfWidth			= 6;
	lf.lfHeight			= 12;
	lf.lfEscapement		= 0;
	lf.lfOrientation	= 0;
	lf.lfWeight			= FW_NORMAL;
	lf.lfItalic			= 0;
	lf.lfUnderline		= 0;
	lf.lfStrikeOut		= 0;
	lf.lfCharSet		= GB2312_CHARSET;

	switch( message )
	{
	case WM_CREATE:						//创建创建时的相关初始化
		regVirtualMouseHotKey( hwnd );
		strcpy( lf.lfFaceName, "Times New Roman" );
		lf.lfHeight = 16;
		lf.lfWidth  = 8;
		lf.lfWeight = FW_NORMAL;
		hFont = CreateFontIndirect (&lf);
		InitWndUI( hwnd, ((LPCREATESTRUCT)lParam)->hInstance, hBtn, hFont, lf );
		if( checkAutorun() )
			SendMessage( hBtn[3], BM_SETCHECK, 1, 0 );
		return 0;

	case WM_COMMAND:					//处理按钮消息
		dealWithBtnMsg( hwnd, wParam, hBtn );	return 0;

	case WM_HOTKEY:						//处理热键消息
		dealWithHotKey( hwnd, wParam );			return 0;

	case WM_PAINT:						//处理重绘消息
		hdc = BeginPaint (hwnd, &ps) ;
		hFont = CreateFontIndirect (&lf);
		SelectObject (hdc, hFont ) ;
		SetBkColor( hdc, RGB(236, 233, 216) );
		drawTipText( hdc );
		DeleteObject( hFont );
		EndPaint (hwnd, &ps) ;
		return 0;

	case WM_NOTIFY:						//处理超链接消息
	  switch (((LPNMHDR)lParam)->code)
	  {
		  case NM_CLICK:
		  case NM_RETURN:
			ShellExecute( NULL, "open", "http://www.cnblogs.com/mr-wid/", NULL, NULL, SW_SHOW );
			break;
	  }
	  return 0;

	case WM_DESTROY:					//退出程序
		GetWindowText( hBtn[0], btnLab, 10 );
		if( strcmp( btnLab, "暂停模拟" ) == 0 )			//当热键没有被注销时
		{
			destroyRegedHotKey( hwnd );					//注销模拟热键
			UnregisterHotKey( hwnd, ID_HOT_WND_HIDE );	//注销主界面呼出热键
			UnregisterHotKey( hwnd, ID_HOT_PAUSE );		//注销暂停\继续热键
		}
		PostQuitMessage( 0 );		return 0;
	}

	return DefWindowProc( hwnd, message, wParam, lParam );
}