⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 worldclock.c

📁 基于联芯客户的SDK软件
💻 C
📖 第 1 页 / 共 2 页
字号:
static SINT32 worldclock_on_keydown(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
    switch ( wParam )
    {
		/*KEY_OK*/
		case SCANCODE_F4:
		/*KEY_LSK*/
		case SCANCODE_F2:
        {
            /*save*/           
   			g_worldclock_select_index = g_worldclock_index;
			if ( -1 == worldclock_set_cur_city())
            {
                tp_mbx_show(hWnd,WORLDCLOCK_STR_OPERATION_ERROR,2,MBX_WARNING);
            }
            else
            {
				MAN_RTC_DATE date_set;
				MAN_RTC_TIME time_set;         
				OS_TIME_ZONE tz;
				time_t ltime;
				struct tm *system_time;

				time( &ltime );

				tz = world_clock_city_location[g_worldclock_index].system_timezone;
				tp_os_timezone_set(tz);
				
				system_time = localtime(&ltime);
				
				//begin fix wangxiao,2007-08-16, Bug00000782 选择一个城市后保存,按power回到idle去看时间则不能马上刷新,要等一分钟以后才能更新。
				date_set.year = system_time->tm_year + 1900;
				date_set.month = system_time->tm_mon + 1;
				date_set.day  = system_time->tm_mday;
				tp_man_date_set( date_set );

				time_set.hour = system_time->tm_hour;
				time_set.min  = system_time->tm_min;
				time_set.sec  = system_time->tm_sec;
				tp_man_time_set( time_set );
				//end fix wangxiao   

                tp_mbx_show(hWnd,WORLDCLOCK_STR_OPERATION_OK,2,MBX_WARNING);
            }
            
            SendNotifyMessage(hWnd, MSG_CLOSE, 0, 0);

            return 0;
        }
		/*KEY_RSK*/
   		case SCANCODE_F3:
        {
            SendNotifyMessage(hWnd, MSG_CLOSE, 0, 0);

            return 0;
        }
		/*KEY_RIGHT*/
   		case SCANCODE_CURSORBLOCKRIGHT:
        {
            g_worldclock_index++;
            if(g_worldclock_index >= WORLDCLOCK_CITY_COUNT)
            {
                g_worldclock_index -= WORLDCLOCK_CITY_COUNT;
            }
            
            break;
        }
		/*KEY_LEFT*/
   		case SCANCODE_CURSORBLOCKLEFT:
        { 
            g_worldclock_index--;
			if(g_worldclock_index < 0)
            {
				g_worldclock_index += WORLDCLOCK_CITY_COUNT;
            }
			
            break;
        }
		/*KEY_UP*/
   		case SCANCODE_CURSORBLOCKUP:
		/*KEY_DOWN*/
  		case SCANCODE_CURSORBLOCKDOWN:
        {
            return 0;
        }
   	    default:
			break;   
    }

    UpdateWindow( hWnd, FALSE);
    
    return DefaultMainWinProc(hWnd, MSG_KEYDOWN, wParam, lParam);
}

/**********************************************************************************
*
* Function:  static SINT32 worldclock_on_close(HWND hWnd, WPARAM wParam, LPARAM lParam)
*
* Purpose:  <describing what the function is to do> 
*
* Relation:  <describing the name, version and position of protocols involved by 
*            this function>
*
* Params:
*
*                                                                                     
*   Name                Type            In/Out          Description                   
* --------              ----            ------          -----------  
*                 
*                                                                                     
* Return:   <comment on the returned values>
*
* Note:     <the limitations to use this function or other comments>
*
***********************************************************************************/
static SINT32 worldclock_on_close(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
    DestroyMainWindowIndirect(hWnd);  
    
    return 0;
}

/**********************************************************************************
*
* Function:  static SINT32 worldclock_on_destroy(HWND hWnd, WPARAM wParam, LPARAM lParam)
*
* Purpose:  <describing what the function is to do> 
*
* Relation:  <describing the name, version and position of protocols involved by 
*            this function>
*
* Params:
*
*                                                                                     
*   Name                Type            In/Out          Description                   
* --------              ----            ------          -----------  
*                 
*                                                                                     
* Return:   <comment on the returned values>
*
* Note:     <the limitations to use this function or other comments>
*
***********************************************************************************/
static SINT32 worldclock_on_destroy(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
	DYNC_APP_INFO app_info;
	STOP_APP_CTRL_INFO worldclock_stop_info;

	tp_dams_get_info(g_worldclock_hdapp, &app_info);

	worldclock_stop_info.id = app_info.id;
	worldclock_stop_info.add_data = 0;
    /* 调用AMS的stop接口 */
    tp_ams_stop_app(&worldclock_stop_info);

	tp_skb_del_items(hWnd);

	//#begin fix wangxiao 2007,7,24 modify for APP:Bug00000696
	tp_resource_default_on_destroy(hWnd, wParam, lParam);

	return DefaultMainWinProc(hWnd, MSG_DESTROY, wParam, lParam);
	//#end fix wangxiao
}

/**********************************************************************************
*
* Function:  static SINT32 worldclock_create_window(HWND hWnd)
*
* Purpose:  <describing what the function is to do> 
*
* Relation:  <describing the name, version and position of protocols involved by 
*            this function>
*
* Params:
*
*                                                                                     
*   Name                Type            In/Out          Description                   
* --------              ----            ------          -----------  
*                 
*                                                                                     
* Return:   <comment on the returned values>
*
* Note:     <the limitations to use this function or other comments>
*
***********************************************************************************/
static SINT32 worldclock_create_window(HWND hWnd)
{
	HWND ret = HWND_INVALID;
    CHAR path[MAX_APP_PATH_LEN + 1];

    BEGIN_STATIC_MSGMAP(worldclock_maps)
    MAPMESSAGE(MSG_INITDIALOG, worldclock_on_initdialog)
	MAPMESSAGE(MSG_ACTIVE, worldclock_on_active)
    MAPMESSAGE(MSG_KEYDOWN, worldclock_on_keydown)
    MAPMESSAGE(MSG_PAINT, worldclock_on_paint)
    MAPMESSAGE(MSG_CLOSE, worldclock_on_close)
    MAPMESSAGE(MSG_DESTROY,worldclock_on_destroy)
	END_STATIC_MSGMAP(worldclock_maps)

	worldclock_get_path(path,WORLDCLOCK_RES_SUB_PATH);
        
    ret = tp_resource_window_create(hWnd,
									(LPARAM )NULLPTR,
									&worldclock_maps,
									path,
									"worldclock",
									(DWORD)0);
    if ( HWND_INVALID == ret )
	{
        return -1;
    }

    return 0;
}

/**********************************************************************************
*
* Function:  SINT32 app_start_function(APP_START_PARAM *param_ptr)
*
* Purpose:  <describing what the function is to do> 
*
* Relation:  <describing the name, version and position of protocols involved by 
*            this function>
*
* Params:
*
*                                                                                     
*   Name                Type            In/Out          Description                   
* --------              ----            ------          -----------  
*                 
*                                                                                     
* Return:   <comment on the returned values>
*
* Note:     <the limitations to use this function or other comments>
*
***********************************************************************************/
SINT32 app_start_function(APP_START_PARAM *param_ptr)
{	
	if(NULLPTR==param_ptr)
		return -1;

	g_worldclock_hdapp = (HDAPP)param_ptr->add_data;

	return worldclock_create_window(param_ptr->host);
}

/**********************************************************************************
*
* Function:  SINT32 app_stop_function(APP_STOP_PARAM *param_ptr)
*
* Purpose:  <describing what the function is to do> 
*
* Relation:  <describing the name, version and position of protocols involved by 
*            this function>
*
* Params:
*
*                                                                                     
*   Name                Type            In/Out          Description                   
* --------              ----            ------          -----------  
*                 
*                                                                                     
* Return:   <comment on the returned values>
*
* Note:     <the limitations to use this function or other comments>
*
***********************************************************************************/
SINT32 app_stop_function(APP_STOP_PARAM *param_ptr)
{
	DYNC_APP_INFO app_info;

	if(NULLPTR==param_ptr)
		return -1;
	
	tp_dams_get_info(g_worldclock_hdapp, &app_info);
	param_ptr->add_data = &app_info.id;

	return tp_ams_default_app_stop(param_ptr);
}

/**********************************************************************************
*
* Function:  SINT32 app_pause_function(APP_PAUSE_PARAM *param_ptr)
*
* Purpose:  <describing what the function is to do> 
*
* Relation:  <describing the name, version and position of protocols involved by 
*            this function>
*
* Params:
*
*                                                                                     
*   Name                Type            In/Out          Description                   
* --------              ----            ------          -----------  
*                 
*                                                                                     
* Return:   <comment on the returned values>
*
* Note:     <the limitations to use this function or other comments>
*
***********************************************************************************/
SINT32 app_pause_function(APP_PAUSE_PARAM *param_ptr)
{
	DYNC_APP_INFO app_info;

	if(NULLPTR==param_ptr)
		return -1;

	tp_dams_get_info(g_worldclock_hdapp, &app_info);
	param_ptr->add_data = &app_info.id;

	return tp_ams_default_app_pause(param_ptr);
}

/**********************************************************************************
*
* Function:  SINT32 app_resume_function(APP_RESUME_PARAM *param_ptr)
*
* Purpose:  <describing what the function is to do> 
*
* Relation:  <describing the name, version and position of protocols involved by 
*            this function>
*
* Params:
*
*                                                                                     
*   Name                Type            In/Out          Description                   
* --------              ----            ------          -----------  
*                 
*                                                                                     
* Return:   <comment on the returned values>
*
* Note:     <the limitations to use this function or other comments>
*
***********************************************************************************/
SINT32 app_resume_function(APP_RESUME_PARAM *param_ptr)
{
	DYNC_APP_INFO app_info; 

	if(NULLPTR==param_ptr)
		return -1;

	tp_dams_get_info(g_worldclock_hdapp, &app_info);
	param_ptr->add_data = &app_info.id;

	return tp_ams_default_app_resume(param_ptr);
}

/**********************************************************************************
*
* Function:  SINT32 app_verify_function(void)
*
* Purpose:  <describing what the function is to do> 
*
* Relation:  <describing the name, version and position of protocols involved by 
*            this function>
*
* Params:
*
*                                                                                     
*   Name                Type            In/Out          Description                   
* --------              ----            ------          -----------  
*                 
*                                                                                     
* Return:   <comment on the returned values>
*
* Note:     <the limitations to use this function or other comments>
*
***********************************************************************************/
SINT32 app_verify_function(void)
{
	return 0;
}

DCM_EXPORT_SYMBOL_BEGIN
DCM_EXPORT_SYMBOL(app_start_function)
DCM_EXPORT_SYMBOL(app_stop_function)
DCM_EXPORT_SYMBOL(app_pause_function)
DCM_EXPORT_SYMBOL(app_resume_function)
DCM_EXPORT_SYMBOL(app_verify_function)
DCM_EXPORT_SYMBOL_END

/*END*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -