#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<unistd.h>
#include<fcntl.h>
#include<minigui/common.h>
#include<minigui/minigui.h>
#include<minigui/gdi.h>
#include<minigui/window.h>
#include<minigui/control.h>
#include<minigui/dti.c>
#include<minigui/mgext.h>
#define ID_TIMER 1100
#define IDC_CALL 1101
#define IDC_MESSAGE 1102
#define IDC_EXIT 1103
#define IDS_NUMBER 1201
#define IDS_TEXT 1202
#define IDS_SEND 1203
#define IDC_NUMBER 2100
#define IDC_N1 2101
#define IDC_N2 2102
#define IDC_N3 2103
#define IDC_N4 2104
#define IDC_N5 2105
#define IDC_N6 2106
#define IDC_N7 2107
#define IDC_N8 2108
#define IDC_N9 2109
#define IDC_N10 2110
#define IDC_N11 2111
#define IDCA_CALL 2112
#define IDCH_HOLD 2113
#define IDC_N14 2114
#define IDC_BACK 2115
#define IDC_TIME 2116
static char number[30];
static char text[1000];
static char buffer[30];
static void WriteMessage();
static void CallTel();
static char buf[30];
static int s=0,m=0,h=0;
static DLGTEMPLATE DlgMessageFiles=
{
WS_VISIBLE|WS_CAPTION|WS_BORDER,
WS_EX_NONE,
0,0,320,240,
"Message",
0,0,
4,NULL,
0
};
static CTRLDATA CtrlMessageFiles[]=
{
{
"static",
WS_VISIBLE|SS_SIMPLE,
10,10,50,30,
IDC_STATIC,
"number",
0
},
{
CTRL_SLEDIT,
WS_VISIBLE|WS_BORDER,
70,10,200,30,
IDS_NUMBER,
"",
0
},
/*{
"staitc",
WS_VISIBLE|SS_SIMPLE,
10,70,40,50,
10000,
"text",
0
},*/
{
CTRL_MLEDIT,
WS_VISIBLE|WS_BORDER|ES_BASELINE|ES_AUTOWRAP,
10,50,300,110,
IDS_TEXT,
"",
0
},
{
"button",
WS_VISIBLE|BS_DEFPUSHBUTTON,
100,180,200,30,
IDS_SEND,
"Send Message",
0
}
};
static int InitMessageFilesBoxProc(HWND hDlg,int message,WPARAM wParam,LPARAM lParam)
{
switch(message)
{
case MSG_INITDIALOG://tty_init();
break;
case MSG_CLOSE:
EndDialog(hDlg,wParam);
break;
case MSG_COMMAND:
switch(wParam)
{
case IDS_SEND: WriteMessage(hDlg);
break;
}
}
return DefaultDialogProc(hDlg,message,wParam,lParam);
}
static void InitMessageFilesBox(HWND hWnd)
{
DlgMessageFiles.controls=CtrlMessageFiles;
DialogBoxIndirectParam(&DlgMessageFiles,hWnd,InitMessageFilesBoxProc,0L);
}
static DLGTEMPLATE DlgCallFiles=
{
WS_VISIBLE|WS_CAPTION|WS_BORDER,
WS_EX_NONE,
0,0,320,240,
"Call",
0,0,
18,NULL,
0
};
static CTRLDATA CtrlCallFiles[]=
{
{
"static",
WS_VISIBLE|SS_SIMPLE,
10,10,40,20,
IDC_STATIC,
"Tel",
0
},
{
CTRL_SLEDIT,
WS_VISIBLE|WS_BORDER,
70,10,120,20,
IDC_NUMBER,
"",
0
},
{
"button",
WS_VISIBLE|BS_DEFPUSHBUTTON,
10,80,90,25,
IDC_N1,
"1",
0
},
{
"button",
WS_VISIBLE|BS_DEFPUSHBUTTON,
110,80,90,25,
IDC_N2,
"2",
0
},
{
"button",
WS_VISIBLE|BS_DEFPUSHBUTTON,
210,80,90,25,
IDC_N3,
"3",
0
},
{
"button",
WS_VISIBLE|BS_DEFPUSHBUTTON,
10,115,90,25,
IDC_N4,
"4",
0
},
{
"button",
WS_VISIBLE|BS_DEFPUSHBUTTON,
110,115,90,25,
IDC_N5,
"5",
0
},
{
"button",
WS_VISIBLE|BS_DEFPUSHBUTTON,
210,115,90,25,
IDC_N6,
"6",
0
},
{
"button",
WS_VISIBLE|BS_DEFPUSHBUTTON,
10,150,90,25,
IDC_N7,
"7",
0
},
{
"button",
WS_VISIBLE|BS_DEFPUSHBUTTON,
110,150,90,25,
IDC_N8,
"8",
0
},
{
"button",
WS_VISIBLE|BS_DEFPUSHBUTTON,
210,150,90,25,
IDC_N9,
"9",
0
},
{
"button",
WS_VISIBLE|BS_DEFPUSHBUTTON,
10,185,90,25,
IDC_N10,
"*",
0
},
{
"button",
WS_VISIBLE|BS_DEFPUSHBUTTON,
210,185,90,25,
IDC_N11,
"#",
0
},
{
"button",
WS_VISIBLE|BS_DEFPUSHBUTTON,
50,40,70,30,
IDCA_CALL,
"CALL",
0
},
{
"button",
WS_VISIBLE|BS_DEFPUSHBUTTON,
150,40,70,30,
IDCH_HOLD,
"HOLD",
0
},
{
"static",
WS_VISIBLE,
240,40,70,30,
IDC_TIME,
"",
0
},
{
"button",
WS_VISIBLE|BS_DEFPUSHBUTTON,
110,185,90,25,
IDC_N14,
"0",
0
},
{
"button",
WS_VISIBLE|BS_DEFPUSHBUTTON,
230,10,40,20,
IDC_BACK,
"back",
0
}
};
static int InitCallFilesBoxProc(HWND hDlg,int message,WPARAM wParam,LPARAM lParam)
{
switch(message)
{
case MSG_INITDIALOG:
{ /* SetTimer(hDlg,ID_TIMER,58);
SetWindowText(GetDlgItem(hDlg,IDC_TIME),buf);*/
break;
}
case MSG_CLOSE:
{
EndDialog(hDlg,wParam);
break;
}
case MSG_COMMAND:
switch(wParam)
{
case IDCA_CALL: //GetWindowText(GetDlgItem(hDlg,IDC_NUMBER),buffer,20);
{ CallTel(hDlg);
SetTimer(hDlg,ID_TIMER,58);
SetWindowText(GetDlgItem(hDlg,IDC_TIME),buf);
gprs_call(buffer,strlen(buffer));
break;
}
case IDC_N1:
{strcat(buffer,"1");
SetWindowText(GetDlgItem(hDlg,IDC_NUMBER),buffer);
break;}
case IDC_N2:
{ strcat(buffer,"2");
SetWindowText(GetDlgItem(hDlg,IDC_NUMBER),buffer);
break;}
case IDC_N3:
strcat(buffer,"3");
SetWindowText(GetDlgItem(hDlg,IDC_NUMBER),buffer);
break;
case IDC_N4:
strcat(buffer,"4");
SetWindowText(GetDlgItem(hDlg,IDC_NUMBER),buffer);
break;
case IDC_N5:
strcat(buffer,"5");
SetWindowText(GetDlgItem(hDlg,IDC_NUMBER),buffer);
break;
case IDC_N6:
strcat(buffer,"6");
SetWindowText(GetDlgItem(hDlg,IDC_NUMBER),buffer);
break;
case IDC_N7:
strcat(buffer,"7");
SetWindowText(GetDlgItem(hDlg,IDC_NUMBER),buffer);
break;
case IDC_N8:
strcat(buffer,"8");
SetWindowText(GetDlgItem(hDlg,IDC_NUMBER),buffer);
break;
case IDC_N9:
strcat(buffer,"9");
SetWindowText(GetDlgItem(hDlg,IDC_NUMBER),buffer);
break;
case IDC_N14:
strcat(buffer,"0");
SetWindowText(GetDlgItem(hDlg,IDC_NUMBER),buffer);
break;
case IDC_N10:
strcat(buffer,"*");
SetWindowText(GetDlgItem(hDlg,IDC_NUMBER),buffer);
break;
case IDC_N11:
strcat(buffer,"#");
SetWindowText(GetDlgItem(hDlg,IDC_NUMBER),buffer);
break;
case IDCH_HOLD:gprs_hold();
KillTimer(hDlg,ID_TIMER);
break;
}break;
case MSG_TIMER:
if(wParam==ID_TIMER)
{
s++;
m=s/60;
h=m/60;
sprintf(buf,"%02d:%02d:%02d",h,m,s%60);
SetWindowText(GetDlgItem(hDlg,IDC_TIME),buf);
UpdateWindow(hDlg,TRUE);
}brea