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

📄 smsh.c

📁 国家ASIC工程中心使用的嵌入式操作系统
💻 C
📖 第 1 页 / 共 5 页
字号:
										else
										{
											SetWindowText(history[i], (*(nowlist2 + i))->name, NULL); 
										}
										switch(*((*(nowlist2 + i))->flag))
										{
											case '1':				//未读短信
												SetWindowText(property[i], NULL, (char *)zi_weidu); 
												break; 
											case '2':				//已读短信
												SetWindowText(property[i], NULL, (char *)zi_yidu); 
												break; 
											case '3':				//发送短信
												SetWindowText(property[i], NULL, (char *)zi_yifasong); 
												break; 
										}
									}
								else
								{
									SetWindowText(history[i], "", NULL);
									SetWindowText(property[i], NULL, NULL); 
								}
							}
						}
						SetWindowText(man, "", NULL); 
						SetWindowText(time, "", NULL); 
						no = -1; 
						SetScrollRange(vscroll, 1, (U16)(length - HIS_DISP_MAX + 1));		//重新设置滚动条长度,并定位到最顶端
						SetScrollPos(vscroll, 1, 0, 0); 
						row = 1;		//偏移量也置为1
//					}
				}
				else
				if(msg.lparam == order)			//点击顺序按钮,在升降序中切换
				{
					switch(orderflag)
					{
						case UP:					//当前为升序时,点击order变为降序
							for(i=0; i<HIS_DISP_MAX; i++)		//更新列表显示
							{
								if(i < listnum)		//数组没结束时显示,否则后面列表为空
									{
										if(strlen((*(nowlist2 + i))->name) == 0)
										{
											if(strlen((*(nowlist2 + i))->sms.number) != 0)
												SetWindowText(history[i], (*(nowlist2 + i))->sms.number, NULL); 
											else
												SetWindowText(history[i], "未写完短信", NULL); 
										}
										else
										{
											SetWindowText(history[i], (*(nowlist2 + i))->name, NULL); 
										}
										switch(*((*(nowlist2 + i))->flag))
										{
											case '1':				//未读短信
												SetWindowText(property[i], NULL, (char *)zi_weidu); 
												break; 
											case '2':				//已读短信
												SetWindowText(property[i], NULL, (char *)zi_yidu); 
												break; 
											case '3':				//发送短信
												SetWindowText(property[i], NULL, (char *)zi_yifasong); 
												break; 
										}
									}
								else
								{
									SetWindowText(history[i], "", NULL);
									SetWindowText(property[i], NULL, NULL); 
								}
							}
							SetScrollPos(vscroll, 1, 0, 0);			//重新定位到顶端
							row = 1;			//偏移量也置为1
							orderflag = DOWN; 
							SetWindowText(order, "\\降序", (char *)zi_down); 
							break; 
						case DOWN:					//当前为降序时,点击order变为升序
							for(i=0; i<HIS_DISP_MAX; i++)		//更新列表显示
							{
								if(i < listnum)		//数组没结束时显示,否则后面列表为空
									{
										if(strlen((*(nowlist + i))->name) == 0)
										{
											if(strlen((*(nowlist + i))->sms.number) != 0)
												SetWindowText(history[i], (*(nowlist + i))->sms.number, NULL); 
											else
												SetWindowText(history[i], "未写完短信", NULL); 
										}
										else
										{
											SetWindowText(history[i], (*(nowlist + i))->name, NULL); 
										}
										switch(*((*(nowlist + i))->flag))
										{
											case '1':				//未读短信
												SetWindowText(property[i], NULL, (char *)zi_weidu); 
												break; 
											case '2':				//已读短信
												SetWindowText(property[i], NULL, (char *)zi_yidu); 
												break; 
											case '3':				//发送短信
												SetWindowText(property[i], NULL, (char *)zi_yifasong); 
												break; 
										}
									}
								else
								{
									SetWindowText(history[i], "", NULL);
									SetWindowText(property[i], NULL, NULL); 
								}
							}
							SetScrollPos(vscroll, 1, 0, 0);			//重新定位到顶端
							row = 1;		//偏移量也置为1
							orderflag = UP; 
							SetWindowText(order, "\\升序", (char *)zi_up); 
							break; 
					}
				}
				else
				if(msg.lparam == read)				//点击阅读按钮
				{
					if(*nowlist == NULL)			//当前列表为空时,提示选择列表
						MessageBox(mainwin, "请选择阅读列表!", "提醒", MB_ICONEXCLAMATION|MB_OK); 
					else
					{
						if(orderflag == UP)			//根据升降序显示列表
						{
							listnum = ReadSMSHistory(no, listnum, nowlist); 
							for(i=0; i<listnum; i++)		//释放结构列表的空间
							{
								Lfree(nowlist[i]); 
							}
							if(strcmp(nowflag, SMS_SEARCH))
							{
								LoadHistory(nowflag, &listnum, nowlist); 
							}
							else
							{
								searchlist = LocalFindRecord(lacb, SMSH_NAME_FIELD, searchnow->keyword, searchnow->searchtype );		//通过上一次的有效查找的记录重新查找
								for(i=0; i<listnum; i++)
								{
									Lfree(nowlist[i]); 
								}
								listnum = searchlist->num;				//刚才列表的个数
//								if(i != listnum)
//									Lfree(nowlist); 
								GetSMSList(nowlist, listnum, searchlist);		//重新读入列表
							}
							length = HIS_DISP_MAX; 
							if(listnum >= HIS_DISP_MAX)			//判断新列表是否需要滚动条
							{
								length = listnum; 
							}
							for(i=0; i<listnum; i++)		//创建逆向列表
							{
								nowlist2[i] = nowlist[listnum - i - 1]; 
							}
//							if(orderflag == UP)				//当前排序为升序时
//							{
								for(i=0; i<HIS_DISP_MAX; i++)		//更新列表显示
								{
									if(i < listnum)		//数组没结束时显示,否则后面列表为空
									{
										if(strlen((*(nowlist + i))->name) == 0)
										{
											if(strlen((*(nowlist + i))->sms.number) != 0)
												SetWindowText(history[i], (*(nowlist + i))->sms.number, NULL); 
											else
												SetWindowText(history[i], "未写完短信", NULL); 
										}
										else
										{
											SetWindowText(history[i], (*(nowlist + i))->name, NULL); 
										}
										switch(*((*(nowlist + i))->flag))
										{
											case '1':				//未读短信
												SetWindowText(property[i], NULL, (char *)zi_weidu); 
												break; 
											case '2':				//已读短信
												SetWindowText(property[i], NULL, (char *)zi_yidu); 
												break; 
											case '3':				//发送短信
												SetWindowText(property[i], NULL, (char *)zi_yifasong); 
												break; 
										}
									}
									else
									{
										SetWindowText(history[i], NULL, NULL);
										SetWindowText(property[i], NULL, NULL); 
									}
								}
/*							}
							else				//当前排序为降序时
							{
								for(i=0; i<HIS_DISP_MAX; i++)		//更新列表显示
								{
									if(i < listnum)		//数组没结束时显示,否则后面列表为空
										SetWindowText(history[i], (*(nowlist2 + i))->name, NULL);
									else
										SetWindowText(history[i], "", NULL); 
								}
							}
*/							SetWindowText(man, "", NULL); 
							SetWindowText(time, "", NULL); 
							no = -1; 
							SetScrollRange(vscroll, 1, (U16)(length - HIS_DISP_MAX + 1));		//重新设置滚动条长度,并定位到最顶端
							SetScrollPos(vscroll, 1, 0, 0); 
							row = 1;		//偏移量也置为1
							break; 
						}
						else
							listnum = ReadSMSHistory(no, listnum, nowlist2); 
							for(i=0; i<listnum; i++)		//释放结构列表的空间
							{
								Lfree(nowlist[i]); 
							}
							if(strcmp(nowflag, SMS_SEARCH))
							{
								LoadHistory(nowflag, &listnum, nowlist); 
							}
							else
							{
								searchlist = LocalFindRecord(lacb, SMSH_NAME_FIELD, searchprev->keyword, searchnow->searchtype );		//通过上一次的有效查找的记录重新查找
								for(i=0; i<listnum; i++)
								{
									Lfree(nowlist[i]); 
								}
								listnum = searchlist->num;				//刚才列表的个数
//								if(i != listnum)
//									Lfree(nowlist); 
								GetSMSList(nowlist, listnum, searchlist);		//重新读入列表
							}
							length = HIS_DISP_MAX; 
							if(listnum >= HIS_DISP_MAX)			//判断新列表是否需要滚动条
							{
								length = listnum; 
							}
							for(i=0; i<listnum; i++)		//创建逆向列表
							{
								nowlist2[i] = nowlist[listnum - i - 1]; 
							}
/*							if(orderflag == UP)				//当前排序为升序时
							{
								for(i=0; i<HIS_DISP_MAX; i++)		//更新列表显示
								{
									if(i < listnum)		//数组没结束时显示,否则后面列表为空
										SetWindowText(history[i], (*(nowlist + i))->name, NULL);
									else
										SetWindowText(history[i], "", NULL);
								}
							}
							else				//当前排序为降序时
							{
*/								for(i=0; i<HIS_DISP_MAX; i++)		//更新列表显示
								{
									if(i < listnum)		//数组没结束时显示,否则后面列表为空
									{
										if(strlen((*(nowlist2 + i))->name) == 0)
										{
											if(strlen((*(nowlist2 + i))->sms.number) != 0)
												SetWindowText(history[i], (*(nowlist2 + i))->sms.number, NULL); 
											else
												SetWindowText(history[i], "未写完短信", NULL); 
										}
										else
										{
											SetWindowText(history[i], (*(nowlist2 + i))->name, NULL); 
										}
										switch(*((*(nowlist2 + i))->flag))
										{
											case '1':				//未读短信
												SetWindowText(property[i], NULL, (char *)zi_weidu); 
												break; 
											case '2':				//已读短信
												SetWindowText(property[i], NULL, (char *)zi_yidu); 
												break; 
											case '3':				//发送短信
												SetWindowText(property[i], NULL, (char *)zi_yifasong); 
												break; 
										}
									}
									else
									{
										SetWindowText(history[i], "", NULL);
										SetWindowText(property[i], NULL, NULL); 
									}
								}
//							}
							SetWindowText(man, "", NULL); 
							SetWindowText(time, "", NULL); 
							no = -1; 
							SetScrollRange(vscroll, 1, (U16)(length - HIS_DISP_MAX + 1));		//重新设置滚动条长度,并定位到最顶端
							SetScrollPos(vscroll, 1, 0, 0); 
							row = 1;		//偏移量也置为1
							break; 
					}
				}
				else							//点选某项历史纪录
				{
					for(i=0; i<HIS_DISP_MAX; i++)		//对所有的按钮进行比较
					{
						if((i + row - 1) < listnum)
						{
							if((msg.lparam == history[i]))
							{
								no = i + row - 1;			//所选历史纪录的序号就是滚动条的偏移量和显示的按钮序号的和
								if(orderflag == UP)			//当前列表是升序时
								{
									if(nowhis != *(nowlist + no))			//当选定记录不是当前记录时,设定当前记录为现在选定记录,并仔man和time文本框中显示人名和时间
									{			
										nowhis = *(nowlist + no); 
										if(strlen(nowhis->name) == 0)
										{
											if(strlen(nowhis->sms.number) != 0)
												SetWindowText(history[i], nowhis->sms.number, NULL); 
											else
												SetWindowText(history[i], "未写完短信", NULL); 
										}
										else
										{
											SetWindowText(man, nowhis->name, NULL); 
										}
										strncpy(disptime, (nowhis->time + 2), 2); 
										*(disptime + 2) = '\0'; 
										strcat(disptime, " "); 
										strncat(disptime, (nowhis->time + 4), 2); 
										strcat(disptime, "."); 
										strncat(disptime, (nowhis->time + 6), 2); 
/*										strcat(disptime, " "); 
										strncat(disptime, (nowhis->time + 8), 2); 
										strcat(disptime, ":"); 
										strncat(disptime, (nowhis->time + 10), 2); 
*/
										SetWindowText(time, disptime, NULL); 
									}
								}
								else			//当前列表是降序时
								{
									if(nowhis != *(nowlist2 + no))			//当选定记录不是当前记录时,设定当前记录为现在选定记录,并仔man和time文本框中显示人名和时间
									{			
										nowhis = *(nowlist2 + no); 
										if(strlen(nowhis->name) == 0)
										{
											if(strlen(nowhis->sms.number) != 0)
												SetWindowText(history[i], nowhis->sms.number, NULL); 
											else
												SetWindowText(history[i], "未写完短信", NULL); 
										}

⌨️ 快捷键说明

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