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

📄 pb_add_dialog.c

📁 基于minigui的智能手机pda源码
💻 C
字号:
#include "../sys_headfile.h"
#include "pb_main.h"
#define IDC_NAME           0xb001
#define IDC_NAME_EDIT               0xb002
#define IDC_TEL     0xb003
#define IDC_TEL_EDIT   0xb004
#define IDC_BUTTON_OK   0xb005
#define IDC_BUTTON_CANCEL  0xb006


CTRLDATA AddCTRALDATA[]=
{
        {
                CTRL_STATIC,
                WS_VISIBLE,
                10,10,40,20,
                IDC_NAME,
                "姓名:",
                0
        },
        
	{
                CTRL_SLEDIT,
                WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP,
                80,10,110,20,
                IDC_NAME_EDIT,
                "",
                0
        },
        
        {
                CTRL_STATIC,
                WS_VISIBLE,
                10,40,80,20,
                IDC_TEL,
                "电话:",
                0
        },        
        {
                CTRL_SLEDIT,
                WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP,
                80,40,110,20,
                IDC_TEL_EDIT,
                "",
                0
        },
        
        {
                "button",
                WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
                33, 68, 74, 23,
                IDC_BUTTON_OK,
                "确定",
                0
        },

        {
                "button",
                WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
                129, 68, 74, 23,
                IDC_BUTTON_CANCEL,
                "取消",
                0
        }				
};

DLGTEMPLATE DlgTime = 
{
        WS_VISIBLE | WS_CAPTION | WS_BORDER,
        WS_EX_NONE,
        45, 31, 235, 120,
        "添加号码",
        0, 0,
        6, AddCTRALDATA,
        0
};

/*******************************************************************************/

static int addContactWinProc(HWND hDlg, int message, WPARAM wParam, LPARAM lParam)
{
    static struct tempData *temp;
    switch (message) {
        case MSG_INITDIALOG:{

                   temp = (struct tempData*) lParam;
		}
                           
	break;

        case MSG_COMMAND:
        {
	    switch(wParam){	
	        case IDC_BUTTON_OK: {

			   HWND hWnd_temp;
			   int len;
		          hWnd_temp = GetDlgItem (hDlg, IDC_NAME_EDIT);                              
		          len = GetWindowTextLength(hWnd_temp);                                  
		          if(len == 0)                                                                
		          {
                              MessageBox (hDlg, "请输入姓名", "错误", MB_OK | MB_ICONINFORMATION);
                              break;
			     
                         }
		           
		           GetWindowText(hWnd_temp,temp->contactName, 20);
		          
		           hWnd_temp = GetDlgItem (hDlg,IDC_TEL_EDIT);                         
		           len = GetWindowTextLength(hWnd_temp);                         									
		     if(len == 0)  																															 
		     {
			       MessageBox (hDlg, "请输入电话号码", "错误", MB_OK | MB_ICONINFORMATION);      
			       break;
			    
                }
		     GetWindowText(hWnd_temp,temp->contactTel, 20);//将电话号码写到文件中去
			EndDialog (hDlg, 0);
	        }break;
	        case IDC_BUTTON_CANCEL:{
               EndDialog(hDlg,0);
	        }break;
	    }
        }
		
        break;

    case MSG_CLOSE:
        {
	    EndDialog (hDlg, 0);
        }
        return 0;
    }

    return DefaultDialogProc (hDlg, message, wParam, lParam);
}


void addDlg(HWND hWnd)
{  
	
	DialogBoxIndirectParam (&DlgTime, hWnd, addContactWinProc, (LPARAM)&contactTemp);
}

⌨️ 快捷键说明

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