📄 win_infocreat.c
字号:
ShowWindow(hIV_menu_infoCreat,SW_SHOW);
EnableWindow( hIV_menu_infoCreat,TRUE);
SetFocusChild( hIV_menu_infoCreat );
SendMessage(hIV_menu_infoCreat,IVM_SELECTITEM,TRUE,0);
SendMessage(hIV_menu_infoCreat,IVM_SETCURSEL,TRUE,0);
ShowReturnPic_InfoAddrbook( FALSE);
SetFocusChild( hIV_menu_infoCreat );
InvalidateRect (hIV_menu_infoCreat, NULL,FALSE);
break;
case SIID_RETURN://return
ClickReturn_infoCreat();//
switch( flagCreatWindowtype ){
case 0:
win_information ( hWndMain); //
break;
case 1:
win_InfoInbox( hWndMain );
break;
case 2:
win_InfoOutbox( hWndMain );
break;
case 3:
win_InfoInbox( hWndMain );
break;
case 4://return addrbook
win_InfoAddrbook (hWndMain, 0);
break;
case 5://return draftbox
win_InfoDraftbox (hWndMain);
break;
case 6:
break;
case 7:
break;
}
break;
case SIID_SPINBOX_0:
if(flag_speedType>0)
{flag_speedType--; // SendMessage (hWndMainInfoCreat,MSG_PAINT , 0 , 0);
InvalidateRect (hWndMainInfoCreat, NULL,TRUE);//re1draw
}
printf("flag_speedType=%d",flag_speedType);
break;
case SIID_SPINBOX_1:
if(flag_speedType<1)
{flag_speedType++; // SendMessage (hWndMainInfoCreat,MSG_PAINT , 0 , 0);
InvalidateRect (hWndMainInfoCreat, NULL,TRUE);
}
printf("flag_speedType=%d",flag_speedType);
break;
case SIID_SPINBOX_2:
if(flag_codeType>0)
{flag_codeType--; // SendMessage (hWndMainInfoCreat,MSG_PAINT , 0 , 0);
InvalidateRect (hWndMainInfoCreat, NULL,TRUE);
}
break;
case SIID_SPINBOX_3:
if(flag_codeType<3)
{flag_codeType++; //SendMessage (hWndMainInfoCreat,MSG_PAINT , 0 , 0);
InvalidateRect (hWndMainInfoCreat, NULL,TRUE);
}
break;
case SIID_CANCEL:
ClickCancel_infoCreat();
InvalidateRect (hwndmledit_infoCreat, NULL,TRUE);
break;
case SIID_B_SEND_0://发到收件箱
//SendMessage (hwndmledit_infoCreat,EM_COPYTOCB,0,0);
sendedItem.txIndex.lockSymbol = 1;//未读图片0,锁定图片1,已读2(空图片)
sendedItem.txIndex.chType =1;//flag_codeType;
sendedItem.txIndex.commType =1;//flag_codeType;
GetWindowText (hwndedit_infoCreat,buff,20);
sendedItem.txIndex.srcID = atol( buff );
printf(" srcID is %ld \n",sendedItem.txIndex.srcID);
sendedItem.txIndex.hour = currTime.hour;
sendedItem.txIndex.minute = currTime.min;
printf("curr time is hour %d: ,min %d\n",currTime.hour,currTime.min);
printf(" Length of string is %d\n",GetWindowTextLength(hwndmledit_infoCreat));
GetWindowText (hwndmledit_infoCreat,buff,20);
memcpy( sendedItem.txIndex.message, buff, 20 );
if( GetWindowTextLength(hwndmledit_infoCreat) <= 20 )
{
//only stored the whole message in file TXINDEX_OUT
sendedItem.txIndex.mainIndex = -1;
}
else
{
GetWindowText (hwndmledit_infoCreat,buff1,200);
// divide the message to two parts,one of it is the
// content the other part is the indexer of the message
sendedItem.txIndex.mainIndex = AddCountMain( OUTBOX, 1 );
// Add the big data block to file TXMAIN_OUT.dat
if( GetCountMain( OUTBOX ) <= AUTOROLLVAL_TXOUT)
{
fp = Fopen( "TXMAIN_OUT.data","a+");
Fwrite( &buff1,MAXSIZE,1,fp );
Fclose( fp );
}
else
{
if( (i = DEQUEUE( OUTBOX )) != 0)
{
fp = Fopen( "TXMAIN_OUT.data","r+");
fseek( fp, (i-1)*MAXSIZE, SEEK_SET );
Fwrite( &buff1,MAXSIZE,1,fp );
Fclose( fp );
}
else if( i == 0)
{
printf("****Fail to get data for the empty queue****\n");
}
}
}
sendedItem.txIndex.contentLen = GetWindowTextLength(hwndmledit_infoCreat);
//whatever,save the indexer of the data
fp = Fopen( "TXINDEX_OUT.data","a+");
Fwrite( &(sendedItem.txIndex),LEN_TXINDEX,1,fp );
Fclose( fp );
AddCount( OUTBOX, TYPE_OF_TXXX, 1);
printf("Saved message is %s\n ",sendedItem.txIndex.message);
printf("Saved message2 is %s\n ",buff1);
//Send to the remote user
GetWindowText (hwndmledit_infoCreat,buff1,GetWindowTextLength(hwndmledit_infoCreat));
GetWindowText (hwndedit_infoCreat,buff,10);
memset(sendArg.srcID, '\0', 10); memcpy(sendArg.srcID, trim( buff ), 6);
sendArg.cmd ="$TXSQ";
sendArg.txsq = txsq;
sendArg.fixedLen = LEN_OF_TXSQ;
sendArg.length = convert(buff1,&(sendArg.txsq->content), 1);
for(i=0;i<j;i++)
printf("%X ",(sendArg.txsq->content)[i]);
printf("\n");
CheckTidCount();
Pthread_create( &tid_Processing[tidProcessing], &attr, SendDataGram, NULL);
break;//case SIID_B_SEND_0:
case SIID_DDD____0:
ClickReturn_infoCreat();//
win_InfoAddrbook(hWndMain , flagCreatWindowtype );
break;
}
}
return 1;
}
static void ShowSpeedTypeCodeType (int speedType,int codeType )
{
//int stringCount = GetWindowTextLength(hwndmledit_infoCreat);
SetBkMode (hdc, BM_TRANSPARENT);
// sprintf(buff, "%d/99",stringCount);//已输入个数
// TextOut (hdc, 91, 0, buff);
TextOut (hdc, RJ_X , 21, "收方" );//收方
TextOut (hdc, 25,WZ_ZTL_Y+1, speedTypeString[speedType]);
TextOut (hdc, 61, WZ_ZTL_Y+1, codeTypeString[codeType]);
}
static int msg_event_cb_infoCreat (HWND hwnd, int message, WPARAM wparam, LPARAM lparam, int* result)
{
int j,i,k;
int line_height=20;
IVITEMINFO ivii;
RECT rc;
switch (message) {
case MSG_CREATE:
printf("msg_event_cb_infoCreat \n");
LoadBitmap (HDC_SCREEN, &bmp_infoCreat, "./Pictures/a_information_5.PNG"); ///
ShowReturnPic_InfoAddrbook( TRUE);
hwndedit_infoCreat = CreateWindow( CTRL_SLEDIT, "",
WS_VISIBLE | WS_CHILD | WS_BORDER ,//|ES_READONLY ,// | ES_AUTOWRAP,
ID_EDIT_EDIT,35, 21,90 , 15, hwnd, 0);
SendMessage (hwndedit_infoCreat, EM_SETLINEHEIGHT,line_height,0);
SendMessage (hwndedit_infoCreat, EM_LIMITTEXT, 7,0L);//set length of inputing text
stringCount_infoCreat = CreateWindow( CTRL_SLEDIT, "0/10",
WS_VISIBLE | WS_CHILD |BM_TRANSPARENT,//|WS_EX_TRANSPARENT ,
456,91, WZ_ZTL_Y+3,30 , WZ_ZTL_HIGH-4, hwnd, 0);
gal_pixel pixel = RGB2Pixel (HDC_SCREEN, 99, 189, 231);
SetWindowBkColor (stringCount_infoCreat, pixel);
printf("222222222222222222222222222222 \n");
//if(flagCreatWindowtype==4)
//{SetWindowText (hwndedit_infoCreat,addrBook[selCurrAddr].usrNo);}
hwndmledit_infoCreat = CreateWindow( CTRL_MLEDIT, "",WS_VISIBLE | WS_BORDER | WS_VSCROLL | ES_AUTOWRAP, ID_EDIT_MLEDIT, 0, 37,158 , 98, hwnd, 0);
SendMessage (hwndmledit_infoCreat, EM_SETLINEHEIGHT,10,0);//行高
SetNotificationCallback ( hwndmledit_infoCreat,mledit_notif_proc);
SendMessage (hwndmledit_infoCreat, EM_LIMITTEXT, 99,0L);//set length of input text
hIV_menu_infoCreat = CreateMenuWindow(hwnd , 90, 10, 1311);
for (i = 0; i < TABLESIZE(MU_lablefiles); i++) {
memset (&ivii, 0, sizeof(IVITEMINFO));
ivii.bmp = NULL;
ivii.nItem = i;
ivii.label = MU_lablefiles[i] ;
ivii.addData = i;
SendMessage (hIV_menu_infoCreat, IVM_ADDITEM, 0, (LPARAM)&ivii);
}
printf("3333333333333333333333333 \n"); GBIMEWindow (hwndmledit_infoCreat); //GBIMEWindowEx ( hwndmledit_infoCreat, 23, 45, 23, 47, FALSE );
/* switch ( flagCreatWindowtype ) {
case 0:
//新建
break;//case 0
case 1:
SetWindowText (hwndedit_infoCreat,inBox[currInfo].sendNo);//回复
break;//case 1
case 2:
SetWindowText (hwndedit_infoCreat,outBox[currInfo].sendNo);//重发
SetWindowText (hwndmledit_infoCreat,outBox[currInfo].content);
break;//case 2
case 3://
SetWindowText (hwndmledit_infoCreat,inBox[currInfo].content);//转发
break;//case 3
case 4:
SetWindowText (hwndedit_infoCreat,addrBook[currInfo].usrNo);//return addrbox
break;//case 4
case 5:
SetWindowText (hwndmledit_infoCreat,draftBox[currInfo].content);//return Draftbox
break;//case 5
case 6:
//国星扩展.新建
break;//case 6
}
*/
break;
case MSG_PAINT :
/*
hdc=BeginPaint (stringCount_infoCreat);
SetBkMode (hdc, BM_TRANSPARENT);
SetBkMode (hdc, BM_TRANSPARENT);
SetTextColor (hdc, PIXEL_blue);
SetBrushColor (hdc, PIXEL_blue);
EndPaint (stringCount_infoCreat,hdc);
*/
hdc=BeginPaint (hwnd);
SetBkMode (hdc, BM_TRANSPARENT);
FillBoxWithBitmap (hdc, ZTL_PIC_X-6,ZTL_PIC_Y, ZTL_PIC_W,ZTL_PIC_H, &bmp_infoCreat);
ShowSpeedTypeCodeType (flag_speedType,flag_codeType );
switch ( flagCreatWindowtype ) {
case 0:
TextOut (hdc, WZ_ZTL_X2, WZ_ZTL_Y, "新建" );//新建
break;//case 0
case 1:
TextOut (hdc, WZ_ZTL_X2, WZ_ZTL_Y, "回复" );//回复
break;//case 1
case 2:
TextOut (hdc, WZ_ZTL_X2, WZ_ZTL_Y, "重发" );//重发
break;//case 2
case 3://
TextOut (hdc, WZ_ZTL_X2, WZ_ZTL_Y, "转发" );//转发
break;//case 3
case 4:
TextOut (hdc, WZ_ZTL_X2, WZ_ZTL_Y, "新建" );//插入
break;//case 4
case 5://
//TextOut (hdc, WZ_ZTL_X4, WZ_ZTL_Y, "新建草稿" );//return draftbox
break;//case 5
case 6:
TextOut (hdc, WZ_ZTL_X2, WZ_ZTL_Y, "新建" );//国星扩展.新建
break;//case 6
}
EndPaint (hwnd,hdc);
/*
ShowWindow ( hwndedit_infoCreat, SW_SHOW);
ShowWindow ( hwndmledit_infoCreat, SW_SHOW);
skin_enable_item (&skin_infoCreat,SIID_DDD____0,TRUE);
skin_show_item (&skin_infoCreat,SIID_DDD____0,TRUE);
if(hideFlag_InfoCreat==1)
{
ShowWindow ( hwndedit_infoCreat, SW_HIDE);
ShowWindow ( hwndmledit_infoCreat, SW_HIDE);
skin_enable_item (&skin_infoCreat,SIID_DDD____0,FALSE);
skin_show_item (&skin_infoCreat,SIID_DDD____0,FALSE);
}
hdc=BeginPaint (stringCount_infoCreat);
sprintf(buff, "puton");
SetBkMode (hdc, BM_TRANSPARENT);
DrawText (hdc, buff, -1, &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
EndPaint (stringCount_infoCreat,hdc);
*/
break;// case MSG_PAINT :
}
return 1;
}
int win_InfoCreat(HWND hwnd ,int curr, int flag ){
MSG msg;
currInfo = curr;
flagCreatWindowtype = flag;
LoadSkinBmps( &skin_infoCreat, TRUE ,bmp_name_infoCreat ,
(sizeof (bmp_name_infoCreat))/sizeof(char *) );
if (skin_infoCreat.bmps == NULL) {
printf ("Could not load skin bitmaps!\n");
return 0;
}
if ( !skin_init (&skin_infoCreat, main_event_cb_infoCreat, msg_event_cb_infoCreat) ){/* 初始化皮肤 */
printf ("skin init fail!\n\n");
return 0;
}
else{
hWndMainInfoCreat= create_skin_control (&skin_infoCreat, hwnd,143, DEF_X_, DEF_Y_,
DEF_WIDTH, DEF_HEIGHT);
currShowWindowHwnd = hWndMainInfoCreat;
return 1;
}
}
#ifndef _LITE_VERSION
#include <minigui/dti.c>
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -