📄 phoneshow.c
字号:
if( flag == 1 )
{
ShowPhone( ReadLastDialPhone, GetDialPhoneNum, button, (U8)scrl );
}
else if( flag == 2 )
{
ShowPhone( ReadLastReceivedPhone, GetReceivedPhoneNum, button, (U8)scrl );
}
else if( flag == 3 )
{
ShowMsgButton( ReadLastSendNews, button, (U8)scrl );
}
else if( flag == 4 )
{
ShowMsgButton( ReadLastReceivedNews, button, (U8)scrl );
}
break;
case WM_QUIT:
quit = 1;
break;
}
DefWindowProc(msg.message, msg.lparam, msg.data, msg.wparam);
}
DestroyWindow(frame);
EndofTask();
}
//////////////////////////////////////////////////////////
void ShowPhone( STATUS(*ReadLastPhone)(void), STATUS(*GetNum)(U8 ,char* ), U32 button[], U8 firstnum )
{
short count, i = 0;
char *phone_num;
phone_num = Lmalloc(sizeof(char * ));
ReadLastPhone();
for( count = 0; count < MAX_LIST_NUM; count++ )
{
if( list_to_display[count] == 0 )
i++;
}
if ( i == MAX_LIST_NUM )
MessageBox(0,"没有电话!!","提示",MB_ICONEXCLAMATION|MB_OK);
else
{
for( count = 0; count < MAX_SHOW_BUTTON_NUM; count++)
{
small_list[count] = list_to_display[firstnum+count];
if( list_to_display[firstnum+count] == 0 )
break;
GetNum( small_list[count], phone_num );
SetWindowText( button[count], phone_num, 0 );
}
}
}
/////////////////////////////////////////////////////////////////////////////
void ShowMsgButton( STATUS (*ReadLastMsg)(void), U32 button[], U8 firstnum )
{
short count, i = 0;
static char str[6][2 * MAX_SHOW_BUTTON_NUM]; // longn_qi 2001/12/26 revised
// This variable must be static (although it is not a good resolution),
// because when this function returns it will be invisible to the button.
// Once repainting the button, error will occur.
ReadLastMsg();
for( count = 0; count < MAX_LIST_NUM; count++ )
{
if( list_to_display[count] == 0 )
i++;
}
if ( i == MAX_LIST_NUM )
MessageBox(0,"没有短信!!","提示",MB_ICONEXCLAMATION|MB_OK);
else
{
for( count = 0; count < MAX_SHOW_BUTTON_NUM; count++)
{
small_list[count] = list_to_display[firstnum+count];
// longn_qi 2001/12/26 added (6)
if( list_to_display[firstnum+count] == 0 )
break;
sprintf( str[count], "短信%d", count+1 );
SetWindowText( button[count], str[count], 0 );
}
}
}
///////////////////////////////////////////////////////
void ShowShortMsg( U32 pGC, STATUS (*GetNewsContent)(U8 ,char *), U8 no )
{
MSG msg;
U32 showmsgframe;
U32 msgbt;
//U32 shbt;
U32 quit=0;
char *news_content;
news_content = Lmalloc( sizeof(char *) );
showmsgframe = CreateWindow(WNDCLASS_WIN, "短信查询", WS_OVERLAPPEDWINDOW|WS_CLOSEBOX, 0,0, PHY_LCD_W, PHY_LCD_H, 0,0,NULL);
msgbt = CreateWindow(WNDCLASS_BUTTON, "确定", WS_CHILD|BS_REGULAR, 40,140,40,20,showmsgframe,0, NULL);
//shbt = CreateWindow(WNDCLASS_BUTTON, NULL, WS_CHILD|BS_ICON, 5,30,110,30,showmsgframe,0, NULL);
GetNewsContent( small_list[no], news_content );
//创建单行编辑器显示短信
DrawText( pGC, news_content, 5, 30, 100, 100, 0, GPC_RED, GPC_REPLACE_STYLE);
//SetWindowText( shbt, news_content, 0 );
while(!quit)
{
ASIXGetMessage(&msg, NULL, 0, 0);
switch(msg.message)
{
case WM_COMMAND:
if ( msg.lparam == msgbt )
{
quit = TRUE;
}
break;
case WM_QUIT:
quit = 1;
break;
}
DefWindowProc(msg.message, msg.lparam, msg.data, msg.wparam);
}
DestroyWindow( showmsgframe );
}
////////////////////////////////////////////////////////////////////
STATUS CreatePhone(char *phone_num)
{
MSG msg;
U32 pGC;
U32 phoneframe, bt1, bt2;
U32 phoneeditor;
U32 phonekb;
U32 quit = 0;
char string[MAX_PHONE_NUM_LEN+5];
short buflen;
pGC = GetGC();
buflen = MAX_PHONE_NUM_LEN;
//string = (U8 *)Lmalloc(MAX_PHONE_NUM_LEN);
//if( string == NULL)
//return ASIX_ERROR;
ClearScreen( pGC, GPC_CADETBLUE );
phoneframe = CreateWindow(WNDCLASS_WIN, "电话", WS_OVERLAPPEDWINDOW|WS_CLOSEBOX, 0,0, PHY_LCD_W, PHY_LCD_H, 0,0,NULL);
//创建多行编辑器输入电话号码
// longn_qi 2001/12/26 added (2)
phoneeditor = CreateWindow(WNDCLASS_EDITOR, phone_num, WS_CHILD|ES_SINGLE_REGULAR|ES_NUMBER, 10, 40, 96, 16, phoneframe, MAX_PHONE_NUM_LEN, NULL);
phonekb = CreateWindow( WNDCLASS_KEYBAR,
NULL,
WS_CHILD,
0,110,
118,16,
phoneframe,
0,
NULL);
bt1 = CreateWindow(WNDCLASS_BUTTON, "拨打", WS_CHILD|BS_REGULAR, 20,139,40,20,phoneframe,0,NULL);
bt2 = CreateWindow(WNDCLASS_BUTTON, "取消", WS_CHILD|BS_REGULAR, 78,139,40,20,phoneframe,0,NULL);
while(!quit)
{
ASIXGetMessage(&msg, NULL, 0, 0);
switch(msg.message)
{
case WM_COMMAND:
if( msg.lparam == bt1 )
{
//拨出电话
strcpy(string, "ATD");
GetEditorStr( phoneeditor, (char *)&string[3], buflen );
string[strlen(string)] = ';';
Send_AT_CMD(string);
SaveNewDialPhone( string, 0 );
Clear_AT_RPS(100);
}
else if( msg.lparam == bt2 )
{
quit = 1;
}
break;
/*
case WM_编辑器:
SetFocus( showframe );
*/
case WM_QUIT:
quit = 1;
break;
}
DefWindowProc(msg.message, msg.lparam, msg.data, msg.wparam);
}
DestroyWindow( phoneframe );
return ASIX_OK;
}
///////////////////////////////////////////////////////////////
STATUS CreateMsg(void)
{
MSG msg;
U32 pGC;
U32 msgframe, bt1, bt2;
U32 msgeditor;
U32 buflen;
U32 quit = 0;
S8 *string;
pGC = GetGC();
string = (U8 *)Lmalloc(MAX_NEWS_LEN);
if( string == NULL)
return ASIX_ERROR;
buflen = MAX_NEWS_LEN;
ClearScreen( pGC, GPC_CADETBLUE );
msgframe = CreateWindow(WNDCLASS_WIN, "短信", WS_OVERLAPPEDWINDOW|WS_CLOSEBOX, 0,0, PHY_LCD_W, PHY_LCD_H, 0,0,NULL);
//创建多行编辑器输入短消息
// longn_qi 2001/12/26 revised
msgeditor = CreateWindow(WNDCLASS_EDITOR, "发送短信", WS_CHILD|ES_MULTI_REGULAR, 10, 40, 96, 76, msgframe, MAX_NEWS_LEN, NULL);
bt1 = CreateWindow(WNDCLASS_BUTTON, "送消息", WS_CHILD|BS_REGULAR, 14,139,40,20,msgframe,0,NULL);
bt2 = CreateWindow(WNDCLASS_BUTTON, "取消", WS_CHILD|BS_REGULAR, 64,139,40,20,msgframe,0,NULL);
while(!quit)
{
ASIXGetMessage(&msg, NULL, 0, 0);
switch(msg.message)
{
case WM_COMMAND:
if( msg.lparam == bt1 )
{
GetEditorStr( msgeditor, string, buflen );
SaveNewSendNews( string, 0 );
//发出消息
}
else if( msg.lparam == bt2 )
{
quit = 1;
}
break;
/*
case WM_编辑器:
SetFocus( showframe );
*/
case WM_QUIT:
quit = 1;
break;
}
DefWindowProc(msg.message, msg.lparam, msg.data, msg.wparam);
}
DestroyWindow( msgframe );
return ASIX_OK;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -