📄 通讯录.asm
字号:
.if uMsg==WM_CLOSE
invoke EndDialog,hWnd,NULL
.elseif uMsg==WM_INITDIALOG
invoke LoadIcon,hInstance,ICO_2
invoke SendMessage, hWnd, WM_SETICON, ICON_BIG,eax
.elseif uMsg==WM_COMMAND
mov eax,wParam
.if ax==IDC_NMODIFY
invoke EndDialog,hWnd,NULL
.elseif ax==IDC_YMODIFY
invoke RtlZeroMemory,addr hword1,sizeof hword1
invoke _odbcconnect,hWnd
invoke SQLExecDirect,hstmt,addr SQLfindStmt1,sizeof SQLfindStmt1
.if ax==SQL_SUCCESS || ax==SQL_SUCCESS_WITH_INFO
invoke SQLBindCol,hstmt,2,SQL_C_CHAR,addr hword1,50,addr word1len
invoke SQLFetch,hstmt
invoke SQLDisconnect, hconn
invoke SQLFreeHandle, SQL_HANDLE_DBC, hconn
invoke SQLFreeHandle, SQL_HANDLE_ENV, henv
invoke GetDlgItemText,hWnd,IDC_OLDKEY,addr oldkey,sizeof oldkey
invoke lstrcmp,addr hword1,addr oldkey
.if eax!=0
invoke MessageBox,hWnd,addr erroroldkey,addr modifykey,MB_OK OR MB_ICONASTERISK
jmp @F
.else
invoke GetDlgItemText,hWnd,IDC_NEWKEY,addr newkey,sizeof newkey
invoke GetDlgItemText,hWnd,IDC_YESNEWKEY,addr ynewkey,sizeof ynewkey
invoke lstrcmp,addr newkey,addr ynewkey
.if eax!=0
invoke MessageBox,hWnd,addr errornewkey,addr modifykey,MB_OK OR MB_ICONASTERISK
jmp @F
.else
invoke _odbcconnect,hWnd
invoke SQLPrepare,hstmt,addr SQLAppStmt1,sizeof SQLAppStmt1
invoke SQLBindParameter,hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR,SQL_CHAR, 50, 0, addr ynewkey, sizeof ynewkey, addr ynewkeylen
invoke lstrlen,addr ynewkey
mov ynewkeylen,eax
invoke SQLExecute,hstmt
invoke SQLDisconnect, hconn
invoke SQLFreeHandle, SQL_HANDLE_DBC, hconn
invoke SQLFreeHandle, SQL_HANDLE_ENV, henv
invoke _odbcconnect,hWnd
invoke SQLPrepare,hstmt,addr SQLdelStmt1,sizeof SQLdelStmt1
invoke SQLBindParameter,hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR,SQL_CHAR, 50, 0, addr oldkey, sizeof oldkey, addr oldkeylen
invoke GetDlgItemText,hWnd,IDC_OLDKEY,addr oldkey,sizeof oldkey
invoke lstrlen,addr oldkey
mov oldkeylen,eax
invoke SQLExecute,hstmt
invoke SQLDisconnect, hconn
invoke SQLFreeHandle, SQL_HANDLE_DBC, hconn
invoke SQLFreeHandle, SQL_HANDLE_ENV, henv
invoke MessageBox,hWnd,addr keyok,addr modifykey,MB_OK OR MB_ICONASTERISK
invoke EndDialog,hWnd,NULL
.endif
.endif
.endif
@@: .endif
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
_DLGMODIFYKEY endp
;******************设置"删除选项"对话框****************************************
_DLGDEL 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 _odbcconnect,hWnd
invoke SQLSetStmtAttr,hstmt,SQL_ATTR_ROW_ARRAY_SIZE,ROWS,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_LISTBOX,LB_ADDSTRING,0,addr [esi]
add esi,50
mov ebx,[esi]
.endw
.endif
.endif
invoke RtlZeroMemory,addr hzhk,sizeof hzhk
invoke SQLDisconnect, hconn
invoke SQLFreeHandle, SQL_HANDLE_DBC, hconn
invoke SQLFreeHandle, SQL_HANDLE_ENV, henv
.elseif uMsg==WM_COMMAND
mov eax,wParam
.if ax==IDC_LISTBOX
shr eax,16
.if ax==LBN_SELCHANGE
invoke SendDlgItemMessage,hWnd,IDC_LISTBOX,LB_GETCURSEL,0,0
mov ebx,eax
invoke SendDlgItemMessage,hWnd,IDC_LISTBOX,LB_GETTEXT,ebx,addr namedel
.endif
.elseif ax==IDC_DELL
.if namedel
invoke MessageBox,hWnd,addr deltext,addr delcaption,MB_OK OR MB_OKCANCEL OR MB_ICONQUESTION
.if eax==IDCANCEL
JMP @F
.endif
invoke _odbcconnect,hWnd
invoke SQLPrepare,hstmt,addr SQLdelStmt,sizeof SQLdelStmt
invoke SQLBindParameter,hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR,SQL_CHAR, 50, 0, addr namedel, sizeof namedel, addr namedellen
invoke lstrlen,addr namedel
mov namedellen,eax
invoke SQLExecute,hstmt
invoke SQLDisconnect, hconn
invoke SQLFreeHandle, SQL_HANDLE_DBC, hconn
invoke SQLFreeHandle, SQL_HANDLE_ENV, henv
invoke SendDlgItemMessage,hWnd,IDC_LISTBOX,LB_FINDSTRINGEXACT,0,addr namedel
invoke SendDlgItemMessage,hWnd,IDC_LISTBOX,LB_DELETESTRING,eax,0
mov byte ptr htest,1
.endif
.elseif ax==IDC_DELALL
invoke MessageBox,hWnd,addr delalltext,addr delcaption,MB_OK OR MB_OKCANCEL OR MB_ICONASTERISK
.if eax==IDCANCEL
JMP @F
.endif
invoke _odbcconnect,hWnd
invoke SQLExecDirect,hstmt,addr SQLdelallStmt,sizeof SQLdelallStmt
invoke SQLDisconnect, hconn
invoke SQLFreeHandle, SQL_HANDLE_DBC, hconn
invoke SQLFreeHandle, SQL_HANDLE_ENV, henv
invoke SendDlgItemMessage,hWnd,IDC_LISTBOX,LB_RESETCONTENT,0,0
mov byte ptr htest1,1
@@: .endif
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
_DLGDEL endp
;********************设置"修改选项"对话框**************************************
_DLGModify 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 SetDlgItemText,hWnd,IDC_NAME,addr hname
invoke SetDlgItemText,hWnd,IDC_QQ,addr hqq
invoke SetDlgItemText,hWnd,IDC_EMAIL,addr hemail
invoke SetDlgItemText,hWnd,IDC_HANDM,addr hhand
invoke SetDlgItemText,hWnd,IDC_TP,addr htp
invoke SetDlgItemText,hWnd,IDC_CODE,addr hcode
invoke SetDlgItemText,hWnd,IDC_ADDRESS,addr haddress
invoke SetDlgItemText,hWnd,IDC_MAINM,addr hmain
invoke SetDlgItemText,hWnd,IDC_MESSAGE,addr hmessage
.elseif uMsg==WM_COMMAND
mov eax,wParam
.if ax==IDCANCEL
invoke EndDialog,hWnd,NULL
.elseif ax==IDOK
invoke GetDlgItemText,hWnd,IDC_NAME,addr hname1,sizeof hname1
invoke lstrcmpi,addr hname,addr hname1
.if eax!=0
invoke MessageBox,hWnd,addr nameerrormod,addr nameerrorm,MB_OK or MB_ICONHAND
invoke SetDlgItemText,hWnd,IDC_NAME,addr hname
jmp @F
.endif
invoke _odbcconnect,hWnd
invoke SQLPrepare,hstmt,addr SQLdelStmt,sizeof SQLdelStmt
invoke SQLBindParameter,hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR,SQL_CHAR, 50, 0, addr namebuf, sizeof namebuf, addr namebuflen
invoke lstrlen,addr namebuf
mov namebuflen,eax
invoke SQLExecute,hstmt
invoke SQLDisconnect, hconn
invoke SQLFreeHandle, SQL_HANDLE_DBC, hconn
invoke SQLFreeHandle, SQL_HANDLE_ENV, henv
invoke _odbcconnect,hWnd
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
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 SQLDisconnect, hconn
invoke SQLFreeHandle, SQL_HANDLE_DBC, hconn
invoke SQLFreeHandle, SQL_HANDLE_ENV, henv
invoke EndDialog,hWnd,NULL
@@: .endif
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
_DLGModify endp
;*****************设置"个人信息查询"对话框*************************************
_DLGMESSAGE 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 _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 SQLBindCol,hstmt,3,SQL_C_CHAR,addr hqq,sizeof hqq,addr qqlen
invoke SQLBindCol,hstmt,4,SQL_C_CHAR,addr hemail,sizeof hemail,addr emaillen
invoke SQLBindCol,hstmt,5,SQL_C_CHAR,addr hhand,sizeof hhand,addr handlen
invoke SQLBindCol,hstmt,6,SQL_C_CHAR,addr htp,sizeof htp,addr tplen
invoke SQLBindCol,hstmt,7,SQL_C_CHAR,addr hcode,sizeof hcode,addr codelen
invoke SQLBindCol,hstmt,8,SQL_C_CHAR,addr haddress,sizeof haddress,addr addresslen
invoke SQLBindCol,hstmt,9,SQL_C_CHAR,addr hmain,sizeof hmain,addr mainlen
invoke SQLBindCol,hstmt,10,SQL_C_CHAR,addr hmessage,sizeof hmessage,addr messagelen
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 SQLFetch,hstmt
.if ax==SQL_SUCCESS || ax==SQL_SUCCESS_WITH_INFO
invoke SetDlgItemText,hWnd,IDC_XNAME,addr hname
invoke SetDlgItemText,hWnd,IDC_XQQ,addr hqq
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -