📄 通讯录.asm
字号:
invoke SetDlgItemText,hWnd,IDC_XEMAIL,addr hemail
invoke SetDlgItemText,hWnd,IDC_XHAND,addr hhand
invoke SetDlgItemText,hWnd,IDC_XTP,addr htp
invoke SetDlgItemText,hWnd,IDC_XCODE,addr hcode
invoke SetDlgItemText,hWnd,IDC_XADDRESS,addr haddress
invoke SetDlgItemText,hWnd,IDC_XMAIN,addr hmain
invoke SetDlgItemText,hWnd,IDC_XMESSAGE,addr hmessage
.endif
invoke SQLDisconnect, hconn
invoke SQLFreeHandle, SQL_HANDLE_DBC, hconn
invoke SQLFreeHandle, SQL_HANDLE_ENV, henv
.elseif uMsg==WM_COMMAND
mov eax,wParam
.if ax==IDOK
invoke EndDialog,hWnd,NULL
.elseif ax==IDC_MODIFY
invoke DialogBoxParam,hInstance,DLG_MODIFY,hWnd,offset _DLGModify,NULL
invoke SetDlgItemText,hWnd,IDC_XQQ,addr hqq
invoke SetDlgItemText,hWnd,IDC_XEMAIL,addr hemail
invoke SetDlgItemText,hWnd,IDC_XHAND,addr hhand
invoke SetDlgItemText,hWnd,IDC_XTP,addr htp
invoke SetDlgItemText,hWnd,IDC_XCODE,addr hcode
invoke SetDlgItemText,hWnd,IDC_XADDRESS,addr haddress
invoke SetDlgItemText,hWnd,IDC_XMAIN,addr hmain
invoke SetDlgItemText,hWnd,IDC_XMESSAGE,addr hmessage
.endif
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
_DLGMESSAGE endp
;***************设置"添加选项"对话框*******************************************
_DIALOGADD proc uses ebx esi edi hWnd,uMsg,wParam,lParam
.if uMsg==WM_CLOSE
invoke EndDialog,hWnd,NULL
.elseif uMsg==WM_INITDIALOG
invoke SendMessage,hWnd,WM_SETICON,ICON_BIG,hico
invoke RtlZeroMemory,addr hname,sizeof hname
.elseif uMsg==WM_COMMAND
mov eax,wParam
.if ax==IDCANCEL
invoke EndDialog,hWnd,NULL
.elseif ax==IDOK
invoke SQLPrepare,hstmt,addr SQLAppStmt,sizeof SQLAppStmt
invoke SQLBindParameter,hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR,SQL_CHAR, 50, 0, addr hname, sizeof hname, addr namelen
invoke SQLBindParameter,hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR,SQL_CHAR, 50, 0, addr hqq, sizeof hqq, addr qqlen
invoke SQLBindParameter,hstmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR,SQL_CHAR, 50, 0, addr hemail, sizeof hemail, addr emaillen
invoke SQLBindParameter,hstmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR,SQL_CHAR, 50, 0, addr hhand, sizeof hhand, addr handlen
invoke SQLBindParameter,hstmt, 5, SQL_PARAM_INPUT, SQL_C_CHAR,SQL_CHAR, 50, 0, addr htp, sizeof htp, addr tplen
invoke SQLBindParameter,hstmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR,SQL_CHAR, 50, 0, addr hcode, sizeof hcode, addr codelen
invoke SQLBindParameter,hstmt, 7, SQL_PARAM_INPUT, SQL_C_CHAR,SQL_CHAR, 50, 0, addr haddress, sizeof haddress, addr addresslen
invoke SQLBindParameter,hstmt, 8, SQL_PARAM_INPUT, SQL_C_CHAR,SQL_CHAR, 50, 0, addr hmain, sizeof hmain, addr mainlen
invoke SQLBindParameter,hstmt, 9, SQL_PARAM_INPUT, SQL_C_CHAR,SQL_CHAR, 200, 0, addr hmessage, sizeof hmessage, addr messagelen
invoke GetDlgItemText,hWnd,IDC_NAME,addr hname,sizeof hname
.if !hname
invoke MessageBox,hWnd,addr noname,addr sadd,MB_OK OR MB_ICONASTERISK
jmp @F
.endif
invoke lstrlen,addr hname
mov namelen,eax
invoke GetDlgItemText,hWnd,IDC_QQ,addr hqq,sizeof hqq
.if !hqq
mov eax,dword ptr [nomessage]
mov dword ptr [hqq],eax
.endif
invoke lstrlen,addr hqq
mov qqlen,eax
invoke GetDlgItemText,hWnd,IDC_EMAIL,addr hemail,sizeof hemail
.if !hemail
mov eax,dword ptr [nomessage]
mov dword ptr [hemail],eax
.endif
invoke lstrlen,addr hemail
mov emaillen,eax
invoke GetDlgItemText,hWnd,IDC_HANDM,addr hhand,sizeof hhand
.if !hhand
mov eax,dword ptr [nomessage]
mov dword ptr [hhand],eax
.endif
invoke lstrlen,addr hhand
mov handlen,eax
invoke GetDlgItemText,hWnd,IDC_TP,addr htp,sizeof htp
.if !htp
mov eax,dword ptr [nomessage]
mov dword ptr [htp],eax
.endif
invoke lstrlen,addr htp
mov tplen,eax
invoke GetDlgItemText,hWnd,IDC_CODE,addr hcode,sizeof hcode
.if !hcode
mov eax,dword ptr [nomessage]
mov dword ptr [hcode],eax
.endif
invoke lstrlen,addr hcode
mov codelen,eax
invoke GetDlgItemText,hWnd,IDC_ADDRESS,addr haddress,sizeof haddress
.if !haddress
mov eax,dword ptr [nomessage]
mov dword ptr [haddress],eax
.endif
invoke lstrlen,addr haddress
mov addresslen,eax
invoke GetDlgItemText,hWnd,IDC_MAINM,addr hmain,sizeof hmain
.if !hmain
mov eax,dword ptr [nomessage]
mov dword ptr [hmain],eax
.endif
invoke lstrlen,addr hmain
mov mainlen,eax
invoke GetDlgItemText,hWnd,IDC_MESSAGE,addr hmessage,sizeof hmessage
.if !hmessage
mov eax,dword ptr [nomessage]
mov dword ptr [hmessage],eax
.endif
invoke lstrlen,addr hmessage
mov messagelen,eax
invoke SQLExecute,hstmt
invoke EndDialog,hWnd,NULL
@@: .endif
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
_DIALOGADD endp
;**************设置主对话框****************************************************
_DIALOGMAIN proc uses ebx esi edi hWnd,uMsg,wParam,lParam
local @buffer[1024]:byte
local @buffer1[128]:byte
local @st:SYSTEMTIME
mov eax,uMsg
.if eax==WM_CLOSE
invoke KillTimer,hWnd,1
invoke EndDialog,hWnd,NULL
.elseif eax==WM_INITDIALOG
invoke SetTimer,hWnd,1,1000,NULL
invoke LoadIcon,hInstance,ICO_MAIN
mov hico,eax
invoke SendMessage,hWnd,WM_SETICON,ICON_BIG,eax
invoke _odbcconnect,hWnd
invoke SQLSetStmtAttr,hstmt,SQL_ATTR_ROW_ARRAY_SIZE,ROWS,0
invoke SQLFetchScroll,hstmt,SQL_FETCH_FIRST,0
invoke SQLExecDirect,hstmt,addr SQLnameStmt,sizeof SQLnameStmt
.if ax==SQL_SUCCESS || ax==SQL_SUCCESS_WITH_INFO
invoke SQLBindCol,hstmt,1,SQL_C_CHAR,addr hzhk,50,addr zhklen
mov esi,0
invoke SQLFetch,hstmt
lea esi,hzhk
.if hzhk
mov ebx,1
.while ebx
invoke SendDlgItemMessage,hWnd,IDC_ZHK,CB_ADDSTRING,0,addr [esi]
add esi,50
mov ebx,[esi]
.endw
invoke SendDlgItemMessage,hWnd,IDC_ZHK,CB_SETCURSEL,0,0
.endif
.endif
invoke SQLDisconnect, hconn
invoke SQLFreeHandle, SQL_HANDLE_DBC, hconn
invoke SQLFreeHandle, SQL_HANDLE_ENV, henv
.elseif eax==WM_TIMER
invoke GetLocalTime,addr @st
movzx eax,@st.wYear
movzx ebx,@st.wMonth
movzx ecx,@st.wDay
invoke wsprintf,addr @buffer,addr sformat0,eax,ebx,ecx
invoke GetLocalTime,addr @st
movzx esi,@st.wDayOfWeek
movzx eax,@st.wHour
movzx ebx,@st.wMinute
movzx ecx,@st.wSecond
.if esi==1
invoke wsprintf,addr @buffer1,addr sformat1,eax,ebx,ecx
.endif
.if esi==2
invoke wsprintf,addr @buffer1,addr sformat2,eax,ebx,ecx
.endif
.if esi==3
invoke wsprintf,addr @buffer1,addr sformat3,eax,ebx,ecx
.endif
.if esi==4
invoke wsprintf,addr @buffer1,addr sformat4,eax,ebx,ecx
.endif
.if esi==5
invoke wsprintf,addr @buffer1,addr sformat5,eax,ebx,ecx
.endif
.if esi==6
invoke wsprintf,addr @buffer1,addr sformat6,eax,ebx,ecx
.endif
.if esi==0
invoke wsprintf,addr @buffer1,addr sformat7,eax,ebx,ecx
.endif
invoke lstrcat,addr @buffer,addr @buffer1
invoke SetDlgItemText,hWnd,IDC_TIME,addr @buffer
.elseif eax==WM_COMMAND
mov eax,wParam
.if ax==IDCANCEL
invoke EndDialog,hWnd,NULL
.elseif ax==IDC_ZHK
shr eax,16
.if ax==CBN_SELENDOK
invoke SendDlgItemMessage,hWnd,IDC_ZHK,CB_GETCURSEL,0,0
mov ebx,eax
invoke SendDlgItemMessage,hWnd,IDC_ZHK,CB_GETLBTEXT,ebx,addr namebuf
invoke DialogBoxParam,hInstance,DLG_MESSAGE,hWnd,offset _DLGMESSAGE,NULL
.endif
.elseif ax==IDC_FINDNAME
invoke GetDlgItemText,hWnd,IDC_FIND,addr namebuf,sizeof namebuf
.if namebuf
invoke _odbcconnect,hWnd
invoke SQLPrepare,hstmt,addr SQLfindStmt,sizeof SQLfindStmt
invoke SQLBindParameter,hstmt,1,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR,\
50,0,addr namebuf,50,addr namebuflen
invoke lstrlen,addr namebuf
mov namebuflen,eax
invoke SQLExecute,hstmt
invoke SQLBindCol,hstmt,2,SQL_C_CHAR,addr hname,sizeof hname,addr namelen
invoke SQLFetch,hstmt
invoke lstrcmpi,addr namebuf,addr hname
.if eax==0
invoke SQLDisconnect, hconn
invoke SQLFreeHandle, SQL_HANDLE_DBC, hconn
invoke SQLFreeHandle, SQL_HANDLE_ENV, henv
invoke DialogBoxParam,hInstance,DLG_MESSAGE,hWnd,offset _DLGMESSAGE,NULL
.else
invoke SQLDisconnect, hconn
invoke SQLFreeHandle, SQL_HANDLE_DBC, hconn
invoke SQLFreeHandle, SQL_HANDLE_ENV, henv
invoke MessageBox,hWnd,addr findfail,addr find,MB_OK OR MB_ICONASTERISK
.endif
.endif
.elseif ax==IDC_ADD
invoke _odbcconnect,hWnd
invoke SQLSetStmtAttr,hstmt,SQL_ATTR_ROW_ARRAY_SIZE,ROWS,0
invoke SQLFetchScroll,hstmt,SQL_FETCH_FIRST,0
invoke SQLSetStmtAttr,hstmt,SQL_ATTR_ROW_STATUS_PTR,SQL_ROW_ADDED,0
invoke DialogBoxParam,hInstance,DLG_ADD,hWnd,offset _DIALOGADD,NULL
.if hname
invoke SendDlgItemMessage,hWnd,IDC_ZHK,CB_ADDSTRING,0,addr hname
invoke SendDlgItemMessage,hWnd,IDC_ZHK,CB_SELECTSTRING,0,addr hname
mov byte ptr [hname],0
.endif
invoke RtlZeroMemory,addr hname,sizeof hname
invoke RtlZeroMemory,addr hqq,sizeof hqq
invoke RtlZeroMemory,addr hhand,sizeof hhand
invoke RtlZeroMemory,addr htp,sizeof htp
invoke RtlZeroMemory,addr haddress,sizeof haddress
invoke RtlZeroMemory,addr hcode,sizeof hcode
invoke RtlZeroMemory,addr hemail,sizeof hemail
invoke RtlZeroMemory,addr hmain,sizeof hmain
invoke RtlZeroMemory,addr hmessage,sizeof hmessage
invoke SQLDisconnect, hconn
invoke SQLFreeHandle, SQL_HANDLE_DBC, hconn
invoke SQLFreeHandle, SQL_HANDLE_ENV, henv
.elseif ax==IDC_DEL
invoke DialogBoxParam,hInstance,DLG_DELETE,hWnd,offset _DLGDEL,NULL
.if byte ptr htest
invoke SendDlgItemMessage,hWnd,IDC_ZHK,CB_FINDSTRINGEXACT,0,addr namedel
invoke SendDlgItemMessage,hWnd,IDC_ZHK,CB_DELETESTRING,eax,0
invoke RtlZeroMemory,addr namedel,sizeof namedel
mov byte ptr htest,0
.endif
.if byte ptr htest1
invoke SendDlgItemMessage,hWnd,IDC_ZHK,CB_RESETCONTENT,0,0
mov byte ptr htest1,0
.endif
.elseif ax==IDC_MODIFYKEY
invoke DialogBoxParam,hInstance,DLG_MODIFYKEY,hWnd,offset _DLGMODIFYKEY,NULL
.elseif ax==IDC_ABOUT
invoke DialogBoxParam,hInstance,DLG_ABOUT,hWnd,offset _DIALOGABOUT,NULL
.endif
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
_DIALOGMAIN endp
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
call _GetProgramPath
invoke DialogBoxParam,hInstance,DLG_LOGIN,0,offset _DLGLOGIN,NULL
.if !(byte ptr hflat)
invoke DialogBoxParam,hInstance,DLG_MAIN,0,offset _DIALOGMAIN,NULL
.endif
invoke ExitProcess,NULL
end start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -